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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Tlotly
Resolver II
Resolver II

RankX with blank column rows issue (related tables)

Good day

 

I've been having endless issues with Ranking that I decided to start the report from scratch. So I now have two tables, PAR and Branch Details. Reason for having Branch Details table is, I will have to add other tables which will link to Branch Details as the report is Branch ranking, where I have to rank branches based on multiple measures, hence multiple tables. 

 

Below is my data model:

Tlotly_0-1695894203536.png

 

So as a start, I'm ranking on one measure i.e. Percentage. The ranking works when I use the Branch Name for the fact table (PAR), as seen below:

     

RankbyPerc = var _perc = CALCULATE(SUM(PAR[Percentage]))

RETURN

RANKX(ALL(PAR[Branch Name]), CALCULATE(sum(PAR[Percentage])), , ASC, Dense)

Tlotly_1-1695894349667.png

 

As soon as I start using the Branch name from the linked table Branch Details which I have to use when I add more tables, the Ranking breaks. This is because there are some branches on the PAR table which are not on the Branch Details table. This is correct as there was nothing on them for the month I'm looking at so I cannot exclude them from the report.

 

Tlotly_2-1695894528479.png

So to get around this, I added a condition to check for blanks, which seems to work but the problem is, it's starting at 2:

RankbyPerc = var _perc = CALCULATE(SUM(PAR[Percentage]))

RETURN

IF(NOT(ISBLANK(_perc)),

RANKX(ALL('Branch Details'[description]), CALCULATE(sum(PAR[Percentage])), , ASC, Dense),BLANK())

Tlotly_3-1695895090297.png


I even tried this formula, but it ranks everything as 1:

RankbyPerc = var _perc = CALCULATE(SUM(PAR[Percentage]))

RETURN IF (

    ISBLANK ( _perc) = FALSE (),

    RANKX (

        ALL ( 'Branch Details'[description] ),

        CALCULATE (

            _perc,

            ALLEXCEPT ( 'Branch Details', 'Branch Details'[description] )

        )

    )

)

Tlotly_5-1695895561083.png

Please assist.

Thanking you in advance.

 



1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.

Top Solution Authors
Top Kudoed Authors