Forum Discussion

Kitkat's avatar
Kitkat
Frequent Visitor
8 years ago
Solved

Summarize and Rank by multiple columns and rows

Total Revenue

Client NameYearMonthRevenue Stream
-1625.7ABC2016101
-11693.9DEF2016102
-598.79GHI2016103
-523.52JKL2016101
-84.85MNO2016102
-8284.16PQR2016103

 

I am trying to create a formula that would take in this order:(Sum of- TotalRevenue by Client Name and Revenue Stream), then i want to rank highest to lowest within each revenue stream by sum of Total Revenue by client

Help super new to DAX- thanks all

12 Replies

    • Kitkat's avatar
      Kitkat
      Frequent Visitor

      I have tried the following function:

      Summarize

       Please advise where my error is

      Thanks kindly and truly appreciate the help

      Cheers

      Kat

      • parry2k's avatar
        parry2k
        Icon for Super User rankSuper User

        create a summarize table, go to modelling tab, click new table and add following:

         

        TableSummarize = SUMMARIZECOLUMNS(Table1[Client Name], Table1[Revenue Stream], "Total Revenue", SUM(Table1[Total Revenue]) )

        Now in above table, add new calculated field for rank:

         

        Rank = RANKX(Filter(TableSummarize, TableSummarize[Revenue Stream] = EARLIER(TableSummarize[Revenue Stream])),TableSummarize[Total Revenue],,DESC,Dense)
    • Kitkat's avatar
      Kitkat
      Frequent Visitor

      Hi v-chuncz-msft- greatly appreciate you pointing me in right direction and more information for the toolkit.

      Cheers

      Kat

       

    • Kpavanteja91's avatar
      Kpavanteja91
      Regular Visitor

      Rank = RANKX(CROSSJOIN(ALLSELECTED(Table[Client Name]),ALLSELECTED(Table[Revenue Stream])),CALCULATE(SUM(Total Revenue)))