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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

RANKX

After trying the full day, I'm hopeless to find the answer, how to rank for one NAME and DATE over the BATCH

 

batch

(number)

date (date)name (text)rank
101/1/2022abc1
221/1/2022abc2
221/1/2022abc2
221/1/2022abc2
461/1/2022abc3
461/1/2022abc3
585/1/2022abc1
585/1/2022abc1
675/1/2022abc2

 

trying all combination of  RANX, FILTER,ALLSELECTED... it returns '1' value only

please help

 

thanks a lot!

1 ACCEPTED SOLUTION
Shaurya
Memorable Member
Memorable Member

Hi @Anonymous,

 

Since you want to rank the Batch column for a particular Name and Date, you'll have to consider all the other records in the Name and Date column with that value. Therefore, you'll have to use the EARLIER() function along with RANKX() and FILTER().

 

Use this DAX Formula:

 

Rank = RANKX(FILTER('Table','Table'[Date]=EARLIER('Table'[Date])&&'Table'[Name]=EARLIER('Table'[Name])),'Table'[Batch],,ASC,DENSE)

 

Here's the result:

 

Screenshot 2022-10-06 060902.jpg 

 

Works for you? Mark this post as a solution if it does!

View solution in original post

3 REPLIES 3
rob7one
Helper I
Helper I

What if i would like to do the rank for one coulmn more? For example to create the rank for the batch column for month, name and additional location (paris, berlin, rome, new york, hongkong etc.). Is this possible?

Shaurya
Memorable Member
Memorable Member

Hi @Anonymous,

 

Since you want to rank the Batch column for a particular Name and Date, you'll have to consider all the other records in the Name and Date column with that value. Therefore, you'll have to use the EARLIER() function along with RANKX() and FILTER().

 

Use this DAX Formula:

 

Rank = RANKX(FILTER('Table','Table'[Date]=EARLIER('Table'[Date])&&'Table'[Name]=EARLIER('Table'[Name])),'Table'[Batch],,ASC,DENSE)

 

Here's the result:

 

Screenshot 2022-10-06 060902.jpg 

 

Works for you? Mark this post as a solution if it does!

Anonymous
Not applicable

Measure 4 = RANKX(ALL('DATE', 'NAME'), calculate(MAX(NUMBER)))
...this is one of my thousends versions which work but return only '1' value

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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