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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
sunnyzags
Frequent Visitor

How to get dynamic index of a column in table

I have a table that changes per country with changes according to slicer for country. At a given moment a particular country is select I have used filter pane to show only top 10 city sales both in table and in pie chart. For reference both look similar to what I have shown below. 

CitySales_leatherSales_tin
A10087
B8087
C7754
D7122
E3467
F6526
G2357
H6514
I3245
J5619

sunnyzags_0-1675099473111.png

Now instead of showing legend of pie charts (as I have one more pie chart in the sheet) I would rather like to have the city columns background colored of the same color code that I want in pie chart. To have it I had created a table with rank and color codes that I need. Now I want the index numbers of each city for the particular selected country and match it with my rank table where I can not merge the relation of a measure with rank table. The rank table is shown below. 

 

rankcolor

1#074E64
2#007FA3
3#30ABCE
4#8DC0DD
5#007770
6#5F7419
7#7E9B21
8#9CBD23
9#808080
10#969696
  
  

I want then for my table to look something similar to this:

sunnyzags_1-1675100024714.png

Of course ,both the background color and pie chart should show same colors. But another problem is I have a slicer which when selected for another country should still follow the same color code ranking as my table. Please help me how could I achieve this. 

 

Thanks in advance 🙂

1 REPLY 1
sunnyzags
Frequent Visitor

Adding to the post, the ranking of cities is based on Sales_Leather + Sales_tin. Though that column is not in the table. I just created a measure and used it in filter. 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.