Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Rankx and Sum at grouped level

Hi everyone,   I have a table with those columns: CompanyCode;Year, Currency, product, SalesAmount,client I am trying to Rank the companies by SalesAmount, summed at the level CompanyCode-Year-Cu...
  • v-juanli-msft's avatar
    7 years ago

    Hi Anonymous 

    Create measures

    Measure =
    CALCULATE (
        SUM ( Sheet5[SalesAmount] ),
        FILTER (
            ALLSELECTED ( Sheet5 ),
            Sheet5[CompanyCode] = MAX ( Sheet5[CompanyCode] )
                && Sheet5[Year] = MAX ( Sheet5[Year] )
                && Sheet5[Currency] = MAX ( Sheet5[Currency] )
        )
    )
    
    Measure 2 = RANKX(ALLSELECTED(Sheet5),[Measure],,DESC,Dense)
    

     

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.