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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
nguyendaithang
Frequent Visitor

Rank sales of each province

Hi every one

 

I have a problem with rank as below. I have a below table with 5 provinces, each province apprears differently (1,2 or rows)

So I must ranks sales based on province as belows. Example: Province A has 3 rows of sales: 70,51,78 => Equivalent Rank: 2,3,1

Therefore I need a DAX formula for rank this table

 

Thank you very much!

 

PROVINCESALESRANK
A702
B231
A513
C342
D292
D141
B262
E221
A781
C221
1 ACCEPTED SOLUTION
joshcomputer1
Helper V
Helper V

Try this as a calculated column:

Rank = rankx(filter(table1, Table1[province]= earlier(Table1[province])),table1[sales])

 

ss1.PNG

View solution in original post

3 REPLIES 3
joshcomputer1
Helper V
Helper V

Try this as a calculated column:

Rank = rankx(filter(table1, Table1[province]= earlier(Table1[province])),table1[sales])

 

ss1.PNG

waw, that works perfectly

Thank you very much!

Baskar
Resident Rockstar
Resident Rockstar

@nguyendaithang

 

Try this.

 

Rank = RANKX(Filter('Rank', 'Rank'[PROVINCE] = EARLIER('Rank'[PROVINCE])),'Rank'[SALES],,DESC,Dense)

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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