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

Dynamic Conditional Colouring in Scatter Plots

Hi! I am trying to built a dashboard for client presentations and have built the below chart where you have one dot for each client. When speaking to a client we are not allowed to show by name where the other clients lie in the chart but would like to show them where they lie compared to their peers in order to benchmark themselves. Therefore, I would like to every time colour the client we present to with say red and all the others with the same colour say black. We have multiple charts like that so we cannot change the legend colours manually every time. Is there an easy way to do conditional colouring in scatter plots?

 

nefeli_ef_0-1603990963190.png

 

Thank you very much, really appreciate any help on this!

 

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

Hello @nefeli_ef

You can use conditional formatting in the scatter plot.

I build a sample table for testing.

My table:

1.png

Then I build a client table. Create a slicer next to this table.

Client = values('Table'[Client])

My measure:

Color = 
VAR _Sel = SELECTEDVALUE(Client[Client])
Return
IF(MAX('Table'[Client])=_Sel,1,0)

Add this measure to the data color in Format.

2.png

The result is as follows. By default, all points will be black, when we select a customer in the slicer, the selected customer point will be red and others in black.

3.png

You can download the pbix file from this link: Dynamic Conditional Colouring in Scatter Plots

Best regards

Rico Zhou

If this post helps,then consider Accepting it as the solution to help other members find it faster.

View solution in original post

4 REPLIES 4
v-rzhou-msft
Community Support
Community Support

Hello @nefeli_ef

You can use conditional formatting in the scatter plot.

I build a sample table for testing.

My table:

1.png

Then I build a client table. Create a slicer next to this table.

Client = values('Table'[Client])

My measure:

Color = 
VAR _Sel = SELECTEDVALUE(Client[Client])
Return
IF(MAX('Table'[Client])=_Sel,1,0)

Add this measure to the data color in Format.

2.png

The result is as follows. By default, all points will be black, when we select a customer in the slicer, the selected customer point will be red and others in black.

3.png

You can download the pbix file from this link: Dynamic Conditional Colouring in Scatter Plots

Best regards

Rico Zhou

If this post helps,then consider Accepting it as the solution to help other members find it faster.

Anonymous
Not applicable

Thank you so much @v-rzhou-msft!! This works now! 

amitchandak
Super User
Super User

@Anonymous , make sure you have an independent client table to color the dot. and Client is not use as legent

 

Measure =

var _cli = maxx(allselected(Indclient),Indclient[Name])

return

if(max(clinet[client]) =_cli , "Red","Green")

 

Use this in conditional formatting with field value options.

refer for steps

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-numbers-in-the-column
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

 

Also  refer: https://youtu.be/Q1vPWmfI25o

Anonymous
Not applicable

Thank you for the response. I have created a table with the Client Names and tried this but I can't get it to work. Can you please have a look at my formula? I get an error saying "Too few arguments were passed to the MAXX function. The minimum argument count for the function is 2." I only have one column I will be filtering in which is the Client List. 

 

I adapted your formula to my table where:

Unique Clients: Table of Client List

Client Aliaslast: Column with Client Names

 

 
Measure = var _cli = maxx(allselected('Unique Clients', 'Unique Clients'[Client Aliaslast]))
return
if(max('Unique Clients'[Client Aliaslast[Ben]) =_cli , "Red","Green")

 

Can you please tell me what is wrong?

 

Thank you!

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.