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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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