Forum Discussion
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?
Thank you very much, really appreciate any help on this!
- Anonymous5 years ago
Hello @nefeli_ef
You can use conditional formatting in the scatter plot.
I build a sample table for testing.
My table:
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.
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.
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.
4 Replies
- amitchandak
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-valuesAlso refer: https://youtu.be/Q1vPWmfI25o
- AnonymousNot 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]))returnif(max('Unique Clients'[Client Aliaslast[Ben]) =_cli , "Red","Green")Can you please tell me what is wrong?
Thank you!
- AnonymousNot applicable
Hello @nefeli_ef
You can use conditional formatting in the scatter plot.
I build a sample table for testing.
My table:
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.
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.
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.
- AnonymousNot applicable
Thank you so much Anonymous!! This works now!