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
chotu27
Post Patron
Post Patron

Don't Rank with Blank Field Value in column

Hi All,

 

I wanted to rank only for category which have names not for all.

 

Data:

CategorySales
Electronics556
Pharmacy88
Bakery999
 800

 

Expected Output:  

 

CategorySalesRank
Electronics5562
Pharmacy883
Bakery9991
 800 

 

DAX Measure Used (Rank) = 

RANKX(ALL('Table'[Category]), CALCULATE(SUM('Table'[Sales]), ALLEXCEPT('Table','Table'[Category])))
 
Can someone Help me to Rank only for the catgeory which has names.
 
 
Note: I don't want to use any filter in transform editor i wanted to see the blank names but not the rank

 

 

 

3 REPLIES 3
RasmusN532
Frequent Visitor

I am having the same problem - did anyone find a solution to this ? 🙂

danextian
Super User
Super User

Hi @chotu27 ,

You can add another argument in your CALCULATE to exclude category items that are blank (assuming they're indeed blank/null). Try this:

DAX Measure Used (Rank) =
RANKX (
    ALL ( 'Table'[Category] ),
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        ALLEXCEPT ( 'Table', 'Table'[Category] ),
        FILTER ( 'Table', 'Table'[Category] <> BLANK () )
    )
)


Alternatively, you can open go to: filter pane > visual filter tile > category > advanced filter > is not blank.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@danextian 

I'm getting all 1's when i use your measure for ranking,

and visual level filter will remove blank fields but it will rank blank field also i wanted exclude blanks while ranking

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.