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
johanthedataman
Frequent Visitor

from Rankx Calculated Column to Measure

Hi guys,

 

I'm really struggling with the following: How can I write the following Rankx Calculated Column as a Measure?

 

Rank =
RANKX (
  FILTER (
  Table,
  Table[organisation_id] = EARLIER ( Table[organisation_id] )
  ),
  Table[Index],
  ,
  ASC,
  DENSE
)
 

This should be the expected outcome. I have this as a calculated column, but due to performance-issues I need this as a measure.

 

organisation_idIndexRank
111
122
133
241
252
361
372
383
491
5101
5112
5123
5134

 

2 ACCEPTED SOLUTIONS

@johanthedataman 

 

Try this

IndexValue = SUM('Table'[Index])
Rank = 
var _selectedID= SELECTEDVALUE('Table'[organisation_id])
var _rank=RANKX(FILTER(ALL('Table'),'Table'[organisation_id]=_selectedID),[IndexValue])
return _rank

Capture.JPG



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

View solution in original post

@johanthedataman 

 

Try this

IndexValue = SUM('Table'[Index])
Rank = 
var _selectedID= SELECTEDVALUE('Table'[organisation_id])
var _rank=RANKX(FILTER(ALL('Table'),'Table'[organisation_id]=_selectedID),[IndexValue],,ASC)
return _rank

Capture.JPG



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂

 


Regards,
Nandu Krishna

View solution in original post

7 REPLIES 7
az38
Community Champion
Community Champion

Hi @johanthedataman 

have a look at this rankx textbook https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Thanks. So far read and tried, it didn't solve my problem. 

@johanthedataman 

 

Try this

IndexValue = SUM('Table'[Index])
Rank = 
var _selectedID= SELECTEDVALUE('Table'[organisation_id])
var _rank=RANKX(FILTER(ALL('Table'),'Table'[organisation_id]=_selectedID),[IndexValue])
return _rank

Capture.JPG



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

@johanthedataman 

 

Try this

IndexValue = SUM('Table'[Index])
Rank = 
var _selectedID= SELECTEDVALUE('Table'[organisation_id])
var _rank=RANKX(FILTER(ALL('Table'),'Table'[organisation_id]=_selectedID),[IndexValue],,ASC)
return _rank

Capture.JPG



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂

 


Regards,
Nandu Krishna

Great, @nandukrishnavs you made my day. 

@johanthedataman  please mark my reply as accepted solution.


Regards,
Nandu Krishna

yes, I did, thanks!

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.