Forum Discussion
Scatter Plot - Highlight Single/Multiple points via Slicer
- Anonymous4 years ago
Hi 8shipsbynight ,
If you want to give each product a color, you can only define a color for each product in the Switch() function.
If in your expected result, the product can be divided into each area to give the color, you can set an Index for the product, and set the color in a certain interval, which will be more convenient.
1. In Power query, add Index to 3 tables, Add Column – Index Column – From 1.
2. Create measure.
Flag_color = var _selectpn=SELECTEDVALUE('MOCK_DATA'[prod number]) var _selectp=SELECTEDVALUE('MOCK_DATA'[product]) var _value=CALCULATE(SUM('MOCK_DATA'[Inex]),FILTER(MOCK_DATA,'MOCK_DATA'[prod number]=_selectpn&&'MOCK_DATA'[product]=MOCK_DATA[product])) return SWITCH( TRUE(), _value>0&&_selectp<100,"red", _value>0&&_selectp<100,"yellow", _value>0&&_selectp<100,"black", _value>0&&_selectp<100,"blue", "white")Then put it in Visual - Format - Data colors - fx to set.
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
Hi 8shipsbynight ,
If you want to give each product a color, you can only define a color for each product in the Switch() function.
If in your expected result, the product can be divided into each area to give the color, you can set an Index for the product, and set the color in a certain interval, which will be more convenient.
1. In Power query, add Index to 3 tables, Add Column – Index Column – From 1.
2. Create measure.
Flag_color =
var _selectpn=SELECTEDVALUE('MOCK_DATA'[prod number])
var _selectp=SELECTEDVALUE('MOCK_DATA'[product])
var _value=CALCULATE(SUM('MOCK_DATA'[Inex]),FILTER(MOCK_DATA,'MOCK_DATA'[prod number]=_selectpn&&'MOCK_DATA'[product]=MOCK_DATA[product]))
return
SWITCH(
TRUE(),
_value>0&&_selectp<100,"red",
_value>0&&_selectp<100,"yellow",
_value>0&&_selectp<100,"black",
_value>0&&_selectp<100,"blue",
"white")
Then put it in Visual - Format - Data colors - fx to set.
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