The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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:
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)
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.
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())
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] )
)
)
)
Please assist.
Thanking you in advance.
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...
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
100 | |
94 | |
80 | |
63 | |
56 |
User | Count |
---|---|
248 | |
122 | |
110 | |
77 | |
70 |