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
Loran
Frequent Visitor

Rank country based on filtered value in card from two tables

Hello all,

 

I want to have two Cards showing the respective export and import rank of a country based on value I have filtered for in a slicer. The country and value are in two different tables, but they are linked in a model by ID:

 

Table 1

[TradeFlow][Value][ID]

Export100CA
Export200CB
Export50CC
Import200CA
Import180CB
Import40CC

 

Table2

[CountryName] [ID]

CountryACA
CountryBCB
CountryCCC

 

I can only do the following two measures, with the second measure (Overall Rank) as value in the Card.

 

Normal Rank =
RANKX(ALLSELECTED('Table1'[ID]),CALCULATE(SUM('Table1'[Value])),,DESC)
 
Overall Rank =
RANKX(ALL('Table1'[ID]),CALCULATE(SUMX('Table1','Table1'[Value])),,DESC)

 

But in this way, the slicer can only be ID and not CountryName, while I need it to be CountryName. I also need the data to be filtered so one slicer shows the export rank of the country while the other one shows the import rank of the country. Who could please help me?

 

Thanks!

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Based on the data tables that you have shared, show the expected result in different fiter scenarios. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

something like this?

Thanks for sharing this! While it works for the sample file you shared, when I use the exact same formulas you used for the real data, the card show the wrong ranks. Please find below a screenshot where you will see that Algeria is not part of the top 12 countries, but when I filter for Algeria in the slicer, it shows the wrong rank. Moreover, I would like to show the correct rank also for when I apply another filter, like year or product, when I apply these filters. So the right export and import rank should be shown when I filter not only for country, but also for a specific year and/or product I put in the slicer. Would this be possible?

 

Many thanks!

 

Loran_1-1677484911193.png

Loran_2-1677484943060.png

 

 

 

Please provide sanitized sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

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!

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