Forum Discussion

Zain26's avatar
Zain26
Icon for Advocate II rankAdvocate II
8 years ago
Solved

Second and Third Maximum Amount and Corresponding Text

Hello All,    Bit inexperienced with PowerBI, I am trying to calculate the Max, 2ndMax and 3rdMax amount based on the following columns. I want the Max of Sum of Amount for each Mapping, then I in...
  • Zubair_Muhammad's avatar
    8 years ago

    Hi Zain26

     

    First define a MEASURE to RANK the Mapping Values..

     

    RANK =
    RANKX (
        ALLSELECTED ( Table1[Mapping] ),
        CALCULATE ( SUM ( Table1[Amount] ) ),
        ,
        desc,
        DENSE
    )

    Now you can get the 1st , 2nd and 3rd mapping values as

     

    FirstMappingValue =
    CALCULATE (
        MAX ( Table1[Mapping] ),
        FILTER ( ALLSELECTED ( Table1[Mapping] ), [RANK] = 1 )
    )
    SecondMappingValue =
    CALCULATE (
        MAX ( Table1[Mapping] ),
        FILTER ( ALLSELECTED ( Table1[Mapping] ), [RANK] = 2 )
    )