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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.