Forum Discussion
Summarize and Rank by multiple columns and rows
Total Revenue | Client Name | Year | Month | Revenue Stream |
| -1625.7 | ABC | 2016 | 10 | 1 |
| -11693.9 | DEF | 2016 | 10 | 2 |
| -598.79 | GHI | 2016 | 10 | 3 |
| -523.52 | JKL | 2016 | 10 | 1 |
| -84.85 | MNO | 2016 | 10 | 2 |
| -8284.16 | PQR | 2016 | 10 | 3 |
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
You may use SUMMARIZE Function to add a calculated table and then use RANKX Function to add a calculated column. The post below is for your reference.
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)
12 Replies
- v-chuncz-msft
Community Support
You may use SUMMARIZE Function to add a calculated table and then use RANKX Function to add a calculated column. The post below is for your reference.
- KitkatFrequent Visitor
I have tried the following function:
Summarize
Please advise where my error is
Thanks kindly and truly appreciate the help
Cheers
Kat
- parry2k
Super 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)
- KitkatFrequent Visitor
Hi v-chuncz-msft- greatly appreciate you pointing me in right direction and more information for the toolkit.
Cheers
Kat
- Kpavanteja91Regular Visitor
Rank = RANKX(CROSSJOIN(ALLSELECTED(Table[Client Name]),ALLSELECTED(Table[Revenue Stream])),CALCULATE(SUM(Total Revenue)))