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
Strueddi
Helper I
Helper I

RANKX ignore empty cells

Hey Guys

 

I am trying to build a rank of my table "Gesamt" . I want to know which values are the newest and second newest of "Sum of 7" for each player. 

I tried now to build a rank for Diff Date (as the difference between the "date" and today. As I don't want the smallest Diff Date if Sum of 7 is empty I made a measure

DIFF DATE SF = CALCULATE(AVERAGE(Gesamt[DIFF Date]),Gesamt[Blank ID]=0)
and the rank as the following
Rank SF = RANKX(ALLEXCEPT(Gesamt,Gesamt[Name Code]),[DIFF DATE SF],,ASC,Dense)
 
Like that, every date with a value for Gewicht but without a value for sum of 7 is ranked as 1. I want to ignore these values and only rank if there are values for sum of 7. "Rank ID" is an indicator if sum of 7 has values or not. 
Could anyone help?
Thanks a lot. 
Sarah
 

Name CodeDatumGewichtSum of 7Diff DateBlank ID

Person 108.03.202480 01
Person 208.03.2024556000
Person 308.03.2024907000
Person 408.03.2024778000
Person 108.02.20247960290
Person 208.02.202453 291
Person 308.02.202489 291
Person 408.02.202476 291
Person 108.01.20248180600
Person 208.01.202452 601
Person 308.01.20248860600
Person 408.01.20247555600
1 ACCEPTED SOLUTION
Strueddi
Helper I
Helper I

I solved it on my own...it was e bug in the "diff Date", because when the date is "today" all the calculations don't work because diff date is "0". 

So with DIFF Date = Today () - Datum +1 everything is working out well now. 

Thanks for your support.

View solution in original post

5 REPLIES 5
Strueddi
Helper I
Helper I

I solved it on my own...it was e bug in the "diff Date", because when the date is "today" all the calculations don't work because diff date is "0". 

So with DIFF Date = Today () - Datum +1 everything is working out well now. 

Thanks for your support.

AmiraBedh
Resident Rockstar
Resident Rockstar

With the FILTER(), I tried to consider rows where "Blank ID" equals 0, effectively ignoring rows where "Sum of 7" is empty.

Rank SF = 
RANKX(
    FILTER(
        ALLEXCEPT(Gesamt, Gesamt[Name Code]),
        Gesamt[Blank ID] = 0
    ),
    [DIFF DATE SF],
    ,
    ASC,
    Dense
)

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Hi Amira

 

thank you for your response and your help. If I use your code, I don't see any change to the ranking I did before. There are still dates with no values for "sum of 7" with the rating 1. 

Strueddi_0-1709906810299.png

This is the "original" data set for one player with "2Rank SF" as your code. 

Do you have another idea?

 

Can you provide textual input data ?


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

What do you mean with "textual input data"? Sorry, I am quite new in that Power BI context. 

 

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.