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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Using RANKX Measure to Create a Rank Frequency Table

Hello

 

I have a task which I've been stuck on for some time and am wondering if is possible through Power BI.

I've created a basic example dataset which I hope will illustrate my requirements.

 

I start with a table with 4 columns:

  • One date column
  • Two category columns
  • One value column

 

1.png

 

I then want to rank this data by date and one category, which I've managed to do using the RANKX function through the following formula:

 
Rank = 
RANKX(
ALLEXCEPT(
Table1,
Table1[Date],
Table1[Category1]),
CALCULATE(AVERAGE(Table1[Value1])),,DESC,DENSE)
 
to produce the following table:
 

2.png

 

My hope is that from this measure I am able to create a table showing the frequency of each category by rank. For example, the result using this data would look like the table below. This shows where Date Slicer = 01/01/2021. On this date, alpha was both rank 1 and 2 a frequency of 1 time, and beta was rank 1 a frequency of 1 time.

 

3.png

 

I have experimented with the DATATABLE function for this but I haven't come up with any result. 

If there is a way to do this and someone has experience, I would greatly appreciate the help.

 

Thanks 

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try to create a calculated column:

Rank = 
RANKX(
FILTER('Table',EARLIER('Table'[category1])='Table'[category1]&&EARLIER('Table'[date])='Table'[date]),
'Table'[value1],,DESC,DENSE)

V-lianl-msft_0-1614151476385.png

 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try to create a calculated column:

Rank = 
RANKX(
FILTER('Table',EARLIER('Table'[category1])='Table'[category1]&&EARLIER('Table'[date])='Table'[date]),
'Table'[value1],,DESC,DENSE)

V-lianl-msft_0-1614151476385.png

 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Please provide sample data in usable format (not as a picture).

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors