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
bsas
Post Patron
Post Patron

Conditional formatting based on rank or value for 2 related charts

Hi All,

I want to set defaul color for team (left chart - number of vacancies per team) and accounts related to that team (right chart - list of accounts with number of vacancies per account) based on rank (e.g. using rankx based on amount of vacancies) or based on some value (e.g. create manual table with index for for each team). 

bsas_1-1630504997198.png

 


I've managed to create rankx and use it in conditional formatting but it works only for left chart and fails on right and I'm not sure if this is correct variant.

How I can change my measure or maybe there is another way to do this formatting? For rank I used RANKX(ALL('dwh DimAccount'[Team]), [# of Vacancies], ,DESC)



 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @bsas ,

I created some data:

Table1:

vyangliumsft_0-1630918811141.png

Table2:

vyangliumsft_1-1630918811142.png

Here are the steps you can follow:

1. Create calculated table.

Slice = DISTINCT('Table1'[date])

2. Create measure.

sortby_un =
var _select=SELECTEDVALUE('Slice'[date])
return
RANKX(FILTER(ALLSELECTED('Table2'),'Table2'[date]=_select),CALCULATE(SUM('Table2'[amount])),,DESC)
sortby_amount =
var _select=SELECTEDVALUE('Slice'[date])
return
RANKX(FILTER(ALLSELECTED('Table1'),'Table1'[date]=_select),CALCULATE(SUM('Table1'[AMOUNT])),,DESC)

3. Change [Team]--Axis, [date]—Legend, [AMOUNT]—Values,[ sortby_amount]—Tooltips in Table 1, and [un]--Axis, [date]—Legend, [amount ]—Values, [sortby_un]—Tooltips

vyangliumsft_2-1630918811143.png

4. In the two visual objects, select the ellipsis and set Sort by-[sortby_amount] and Sort by-[sortby_un]

vyangliumsft_3-1630918811146.png

5. Result:

Both visual objects are automatically sorted according to measure

vyangliumsft_4-1630918811148.png

If it does not meet your expected results, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @bsas ,

I created some data:

Table1:

vyangliumsft_0-1630918811141.png

Table2:

vyangliumsft_1-1630918811142.png

Here are the steps you can follow:

1. Create calculated table.

Slice = DISTINCT('Table1'[date])

2. Create measure.

sortby_un =
var _select=SELECTEDVALUE('Slice'[date])
return
RANKX(FILTER(ALLSELECTED('Table2'),'Table2'[date]=_select),CALCULATE(SUM('Table2'[amount])),,DESC)
sortby_amount =
var _select=SELECTEDVALUE('Slice'[date])
return
RANKX(FILTER(ALLSELECTED('Table1'),'Table1'[date]=_select),CALCULATE(SUM('Table1'[AMOUNT])),,DESC)

3. Change [Team]--Axis, [date]—Legend, [AMOUNT]—Values,[ sortby_amount]—Tooltips in Table 1, and [un]--Axis, [date]—Legend, [amount ]—Values, [sortby_un]—Tooltips

vyangliumsft_2-1630918811143.png

4. In the two visual objects, select the ellipsis and set Sort by-[sortby_amount] and Sort by-[sortby_un]

vyangliumsft_3-1630918811146.png

5. Result:

Both visual objects are automatically sorted according to measure

vyangliumsft_4-1630918811148.png

If it does not meet your expected results, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Thanks @v-yangliu-msft , great solution!

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.