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
Black_magic100
Helper III
Helper III

How to set RankX values if value = ***

I have a table with 2 columns as seen below.  In this table their are 20 ROWS, which declare a name of a location.  Currently my formula ranks the values accordingly, but I need to adjust the ranking.  How can I add to my formula a condition where if the Sum Column value = Null/Blank then RankX column = 20.

 

Formula:

CycleGiving and Private Rides MTD = CALCULATE(DISTINCTCOUNT(ClassSchedule[ClassScheduleID]),FILTER(ClassSchedule,RELATED('Calendar'[CurMonthOffset] ) = 0), FILTER(ClassSchedule,RELATED('Calendar'[FutureDate] ) = "Past"),FILTER('Classes@ClassCategory','Classes@ClassCategory'[CategoryId] IN {680, 681, 682}),FILTER(ClassSchedule,ClassSchedule[Cancelled] = BLANK()))
 
RankX formula: 
CG/Private Rides Rank =
RANKX (
ALL(GeneralPrefs[LocationName]),
[CycleGiving and Private Rides MTD])

 

Sum Column | RankX Column

6,1

4,2

4,2

3,4

2,5

1,6

1,6

1,6 

1,6

1,6

1,6

1,6

1,6

1,6 

1,6

Blank,16 

Blank,16 

Blank,16 

Blank,16 

Blank,16 

   

               

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

Try this measure

 

RankX formula: CG/Private Rides Rank = IF(ISBLANK([your_measure),20,RANKX(ALL(GeneralPrefs[LocationName]),[CycleGiving and Private Rides MTD]))
 
your_measure is the measure appearing under the SUM column.

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

 

Try this measure

 

RankX formula: CG/Private Rides Rank = IF(ISBLANK([your_measure),20,RANKX(ALL(GeneralPrefs[LocationName]),[CycleGiving and Private Rides MTD]))
 
your_measure is the measure appearing under the SUM column.

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Wow I tried to do the exact same thing, but failed miserably.  I think the hardest part about DAX as I am slowly learning it is realizing how important the order of the syntax is.  Definitely something I will learn over time, but I my mistakes always seem to derive from that.  Stupid mistake for sure.  Thank you friend.

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.