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
cjcj
Helper I
Helper I

Rankx multiple tables

Hi, I have a table visualization pulling in data from multiple connected tables and a measure and I am seeing unexpected results when adding a rankx measure.

 

RANKX (
ALLSELECTED ('MeasureTableX'),
CALCULATE (
[Sales],
ALLEXCEPT(Table1, Table1[ID]),
ALLEXCEPT(Table2, Table2[Location]),
ALLEXCEPT(Table3, Table3[Product]))
,,DESC
)

 

cjcj_1-1661979150987.png

 

any thoughts would be appreciated.

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @cjcj,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
bcdobbs
Super User
Super User

Hard to diagnose without some dummy data/ideally an example pbix. However... straight away I would look to remove the ALLEXCEPT lines and instead use an ALL / VALUES approach. Have a read of https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/ you tend to avoid a lot of pain that way,



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

How are the tables related. Can you describe MeasureTableX? I suspect that might be causing the issue as you really want to rank over a table at the same grain as your visual.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Hi, MeasureTableX is just a table of measures...so not really a table.  Not sure if rankx syntax would take a table of measures vs an actual table. 

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.