Forum Discussion

johanthedataman's avatar
johanthedataman
Frequent Visitor
6 years ago
Solved

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

 

  • nandukrishnavs's avatar
    nandukrishnavs
    6 years ago

    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



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

  • nandukrishnavs's avatar
    nandukrishnavs
    6 years ago

    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



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

     

7 Replies