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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
bsz412
Helper III
Helper III

RANKX to skip blanks - calculated column

Hi, 

 

I have the following calculated column

 

Rank = 

RANKX (
CALCULATETABLE (
EPD,
ALLEXCEPT ( EPD,EPD[Country],globalproduct[ETIM_class] )
),
EPD[AVG total per ETIM and country],
,
ASC,
DENSE
))
 
I have a few cells were EDP[AVG total per ETIM and country] is blank, and I would like RANKX to skip those when calculating rank. 
 
I have tried this: 
Ranking2 =

IF(
NOT (ISBLANK (
EPD[AVG total per ETIM and country]
)),
RANKX (
CALCULATETABLE (
EPD,
ALLEXCEPT ( EPD,EPD[Country],globalproduct[ETIM_class] )
),
EPD[AVG total per ETIM and country],
,
ASC,
DENSE
))

This leaves the corresponding cells in rankx blank, but when calculating  ranking, it does not ignore those blanks, so it did not fix the issue.
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @bsz412 ,

 

You need to filter out the blanks on the table you are making the calculation for the ranking try the following:

 

Rank =
RANKX (
    FILTER (
        ADDCOLUMNS (
            CALCULATETABLE (
                EPD,
                ALLEXCEPT ( EPD, EPD[Country], globalproduct[ETIM_class] )
            ),
            "AVGValue", [AVG total per ETIM and country]
        ),
        [AVGValue] <> BLANK ()
    ),
    [AVG total per ETIM and country],
    ,
    ASC,
    DENSE
)

Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
bsz412
Helper III
Helper III

Perfect, thank you!

MFelix
Super User
Super User

Hi @bsz412 ,

 

You need to filter out the blanks on the table you are making the calculation for the ranking try the following:

 

Rank =
RANKX (
    FILTER (
        ADDCOLUMNS (
            CALCULATETABLE (
                EPD,
                ALLEXCEPT ( EPD, EPD[Country], globalproduct[ETIM_class] )
            ),
            "AVGValue", [AVG total per ETIM and country]
        ),
        [AVGValue] <> BLANK ()
    ),
    [AVG total per ETIM and country],
    ,
    ASC,
    DENSE
)

Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.