How to create a measure Max values based on multiple columns

Learner DAX 41 Reputation points
2020-11-17T16:21:33.913+00:00

Hi
I am trying to create a measure which shows Max values based on 4 columns. Below is the table format

40370-image.png

But I would like create a measure which shows data in below format

40416-image.png

There are other columns apart from these 4 columns but I would like to see Max value based on these columns only.

Please advise..

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,201 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Lz._ 9,006 Reputation points
    2020-11-17T16:52:18.437+00:00

    Hi @Learner DAX

    It's not really clear to me if you're after a Power Query of Power Pivot solution... Assuming it's Power Query and with the table you exposed:

    let  
        ......,  
        PreviousStepName = ...,  
        GroupedRows = Table.Group(PreviousStepName, {"ColumnA"},  
            {"GRP_ColA", (t)=>  
                Table.RemoveColumns(  
                    Table.SelectRows(  
                        Table.AddColumn(t, "IsMax", each  
                            [Value] = List.Max(Table.Column(t,"Value")),  
                            type logical  
                        ),  
                        each [IsMax]  
                    ),  
                    {"IsMax"}  
                ),  
                type table  
            }  
        ),  
        CombinedNestedTables = Table.Combine(GroupedRows[GRP_ColA])  
    in  
        CombinedNestedTables  
    

    Any question please let me know and if this solves your problem please mark this reply as answer to help others with a similar scenario. Thanks in advance & Nice day...

    EDIT A sample is available here


  2. Lz._ 9,006 Reputation points
    2020-11-18T07:23:06.627+00:00

    Hi @Learner DAX

    A simplified version of the previous proposal:

    let  
        ....,  
        PreviousStepName = ...,  
        GroupedRows = Table.Group(PreviousStepName, {"ColumnA"},  
            {"GRP_ColA", (t)=>  
                Table.SelectRows(t, each [Value] = List.Max(Table.Column(t,"Value"))),  
                type table  
            }  
        ),  
        CombinedNestedTables = Table.Combine(GroupedRows[GRP_ColA])  
    in  
        CombinedNestedTables  
    

    Sample updated (same link)

    And BTW, what do you expect in the following situation?:

    40459-demo.png

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.