Forum Discussion

kirbynguyen's avatar
kirbynguyen
Icon for Helper II rankHelper II
5 years ago
Solved

Max of Aggregation

Hello, I am trying to find the max of aggregated data and I've been having trouble. Here is a sample input: Date     Name     Category     Value 1/1/2021 A Bag 5 1/2/2021 A Ba...
  • TomMartens's avatar
    5 years ago

    Hey kirbynguyen ,

     

    I assume this measure creates what you are looking for:

    Measure = 
    var __t =
        ADDCOLUMNS(
            CALCULATETABLE(
                SUMMARIZE(
                    'Table'
                    , 'Table'[Name    ]
                    , 'Table'[Category    ]
                )
                , ALL( 'Table'[Category    ] )
            )
            , "val" , CALCULATE( SUM( 'Table'[Value] ) )
        )
    return
    
        GROUPBY(
            __t
            , "v" , MAXX( CURRENTGROUP() , [val] )
        ) 

    At least it allows to create a table visual that shows the desired output:

    Hopefully, this is what you are looking for.

     

    Regards,
    Tom