Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
patshannon11
Frequent Visitor

Create Calculated Table with a Rank Column that Interacts with Columns in Original Source Table

My goal is to create a summary table with a rank column that will update when filtering on different columns from the source data table.  I'm starting with a source data table similar to this:

 

ZIP CodeSettingServiceVolume
10001InpatientCancer15
10002InpatientCancer8
10003InpatientCancer2
10004InpatientCancer5
10001OutpatientCancer6
10002OutpatientCancer13
10003OutpatientCancer2
10004OutpatientCancer7
10001InpatientCancer5
10002InpatientCancer9
10003InpatientCardiac18
10004InpatientCardiac4
10001OutpatientCardiac5
10002OutpatientCardiac2
10003OutpatientCardiac1
10004OutpatientCardiac5
10001InpatientCardiac8
10002InpatientCardiac4
10003InpatientCardiac6
10004InpatientCardiac13
10001OutpatientNeurologic14
10002OutpatientNeurologic5
10003OutpatientNeurologic8
10004OutpatientNeurologic5
10001InpatientNeurologic6
10002InpatientNeurologic11
10003InpatientNeurologic3
10004InpatientNeurologic9
10001OutpatientNeurologic1
10002OutpatientNeurologic5
10003OutpatientOrthopedic6
10004OutpatientOrthopedic5
10001InpatientOrthopedic4
10002InpatientOrthopedic1
10003InpatientOrthopedic12
10004InpatientOrthopedic3
10001OutpatientOrthopedic2
10002OutpatientOrthopedic1
10003OutpatientOrthopedic5
10004OutpatientOrthopedic18

 

I've created a calculated table with a rank measure using the DAX below:

 

 

 

 

Ranking Table = SUMMARIZE('Data','Data'[Service],"Volume",SUM(Data[Volume]))
Rank = RANK(DENSE, ALLSELECTED('Ranking Table'), ORDERBY('Ranking Table'[Volume], DESC), LAST)​

 

 

 

 

This results in the following summary table:

 

RankService

Volume

1Cancer72
2Neurologic67
3Cardiac66
4Orthopedic57

 

I would utlimately like the Rank column to update when filtering on columns "ZIP Code" and "Setting" in the original source table, but I'm having trouble finding out how to create that relationship.  For example, If I filter on "ZIP Code = 10001" and "Setting = Outpatient" I would like the summary table to read as follows:

 

RankService

Volume

1Neurologic15
2Cancer6
3Cardiac5
4Orthopedic

2

 

Any help is appreciated!

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@patshannon11 

pls try this

rank = rankx(ALLSELECTED('Table'[Service]),[_volumn])

11.PNG22.PNG

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
ryan_mayu
Super User
Super User

@patshannon11 

pls try this

rank = rankx(ALLSELECTED('Table'[Service]),[_volumn])

11.PNG22.PNG

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Yes you're correct - I realized I omitted a key element:

 

The summary ranked table should contain a measure, not a column from the data source (I couldn't use the RANK functions with a measure which is why I was trying the calculated table route).  I reposted with that correction here:

 

https://community.fabric.microsoft.com/t5/Desktop/Create-Summary-Ranked-Table-Containing-a-Measure-t...

CoreyP
Solution Sage
Solution Sage

Try not creating a calculated table, but use a measure on your source table with RANKX.

Yes you're correct - I realized I omitted a key element:

 

The summary ranked table should contain a measure, not a column from the data source (I couldn't use the RANK functions with a measure which is why I was trying the calculated table route).  I reposted with that correction here:

 

https://community.fabric.microsoft.com/t5/Desktop/Create-Summary-Ranked-Table-Containing-a-Measure-t...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors