The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have the following scatterplot and want to change the color of the markers for the groups selected by the slicer.
Is it possible to achieve this using the DAX formula or other functions?
1. When group A is selected, the corresponding items will be red, and items in groups B and C will be gray.
2. When group B is selected, the corresponding item will be yellow, and the items corresponding to groups A and C will be gray
3. When group C is selected, the corresponding item will be blue and the items corresponding to groups A and B will be gray.
Solved! Go to Solution.
Hi @nanacobsbs,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Regards,
Vinay Pabbu
Hi @nanacobsbs,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Regards,
Vinay Pabbu
HI @nanacobsbs ,
Yes, you can achieve this using DAX in Power BI by creating a Measure for the color logic and applying it to the scatterplot’s conditional formatting.
Steps to Implement:
Create a Measure to determine the color dynamically based on the slicer selection.
Apply this Measure to the scatterplot's marker color conditional formatting.
DAX Measure for Dynamic Coloring
ColorMeasure =
VAR SelectedGroup = SELECTEDVALUE('GroupTable'[Group]) -- Gets the selected group from the slicer
VAR CurrentGroup = MAX('DataTable'[Group]) -- Retrieves the group for the current row in the visualization
RETURN
SWITCH(
TRUE(),
SelectedGroup = "A" && CurrentGroup = "A", "Red",
SelectedGroup = "A" && CurrentGroup <> "A", "Gray",
SelectedGroup = "B" && CurrentGroup = "B", "Yellow",
SelectedGroup = "B" && CurrentGroup <> "B", "Gray",
SelectedGroup = "C" && CurrentGroup = "C", "Blue",
SelectedGroup = "C" && CurrentGroup <> "C", "Gray",
"Gray" -- Default color (when nothing is selected)
)
How to Apply This in Power BI Scatterplot:
Select the Scatterplot Visualization
Go to the Format Pane → Shapes
Expand "Markers" → fx (Conditional Formatting for Marker Color)
Choose "Field Value"
Select the "ColorMeasure" DAX Measure
Click OK
Please mark this post as solution if it helps you. Appreciate Kudos.
Thank you for your reply.
I tried to create the measure above, but it doesn't work as bellow.
I would like to have Group A checked with the slicer but still have Group B and C markers visible and their colors grayed out.
Is it possible to achieve such a thing?
Hi @nanacobsbs,
When you select Group A in the slicer, Power BI filters the visual to show only Group A, which is why B and C markers disappear — not just their colors.
To fix this, you need to disconnect the slicer from filtering the scatter plot, and instead only use the slicer for the color logic.
Regards,
Vinay Pabbu
Thank you for your help!! It worked!!
User | Count |
---|---|
24 | |
10 | |
8 | |
7 | |
6 |
User | Count |
---|---|
32 | |
12 | |
10 | |
10 | |
9 |