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
Anonymous
Not applicable

Rankx issue - tables not directly related

Hi All,

 

The test PowerBI file for this specific issue is attached here: 201010 Test Rank. 

 

The issue is rankx where the tables are not directly related.

 

I have a model with a fact table and a summary table that rolls up countries and cities; and country and city slicer tables. The model looks like this:

 

The issue is rankx where the tables are not directly related.

I have a model with a fact table and a summary table that rolls up countries and cities; and country and city slicer tables. The model looks like this:

 

Keelin_0-1602316488069.png

I have set the model up this way as in the real data I have multiple fact tables and the need for both a country and a city slicer both with an overall result for all countries or cities. I have tried to demonstrate the slicer setup in the test dashboard that looks like this:

 

Keelin_1-1602316581548.png

 

I am struggling with the rank function using the countries or the cities table. It is returning a 1 regardless of what I try.

 

I can't create a standalone summarized table as there are a number of other dynamic slicers on the dashboard. 

 

I have tried every combination of rankx with summarize that I can come up with and I keep getting 1. 

 

I would really appreciate any help. 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

The ranking issue is the least of your problems.  You will want to reconsider your data model.

 

With very few exceptions cities do not exist in multiple countries.  You should use a single geography hierarchy with a single filter direction  countries>cities>facts

 

You can still use separate tables for countries and cities if you want but you can also put them in the same table.  The slicers don't care if there are other columns in the slicer source table.

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

The ranking issue is the least of your problems.  You will want to reconsider your data model.

 

With very few exceptions cities do not exist in multiple countries.  You should use a single geography hierarchy with a single filter direction  countries>cities>facts

 

You can still use separate tables for countries and cities if you want but you can also put them in the same table.  The slicers don't care if there are other columns in the slicer source table.

Anonymous
Not applicable

Thanks @lbendlin. I pondered over this for quite a while and your suggestion of using a single geographic hierarchy is of course the right way to go. The model is cleaner and I can still have an 'All' record in there for each now that I have redesigned the table.

 

Thanks for your time in responding and encouraging me to think more deeply about the data model. Greatly appreciated. 

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.