Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
8shipsbynight
Helper I
Helper I

Scatter Plot - Highlight Single/Multiple points via Slicer

I've seen multiple Questions about how to highlight a single point on a scatter plot, but they don't seem to be as complex as my needs. I'm working with a single table, but with the need to use 2 slicers. 1 slicer for a customer and another slicer for product. You would select the customer first and then a product(s).

 

Is there a way to highlight the product(s) on a scatter plot after selecting the customer?

 

Here is a sample PBIX:

https://drive.google.com/file/d/1idk72rmLr5C1Eawdj4hHAv5sk7KAh-Rj/view?usp=sharing 

 

Here is a sample screenshot of what I'm trying to accomplish:

sample.jpg

 

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

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.

vyangliumsft_0-1645175846029.png

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

 

View solution in original post

5 REPLIES 5
v-yangliu-msft
Community Support
Community Support

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.

vyangliumsft_0-1645175846029.png

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

 

v-yangliu-msft
Community Support
Community Support

Hi  @8shipsbynight ,

Here are the steps you can follow:

1. Create measure.

Flag =
var _select= SELECTEDVALUE('MOCK_DATA'[acct Name])
return
SWITCH(
    TRUE(),
    _select="Auto Company","red",
    _select="Box Store","green",
    "blue")

2. Click Visual - Format - Data colors -- fx

vyangliumsft_0-1645077647207.png

3. Enter the Default color interface.

Format style – Field value

What field should we base this on – [Flag]

vyangliumsft_1-1645077647210.png

4. Result:

The selection is Auto Company, shown in red:

vyangliumsft_2-1645077647219.png

The selection is Box Store and the color is green:

vyangliumsft_3-1645077647223.png

 

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 

 

This looks like it is moving in the right direction. I don't want to color the dots by Acct Name or account. I want to color the dots by product/prod number.

 

I see that you programmed "Auto Company" to be red and "Box Store" to be green - this is great if you only have a handful of items in the slicer that you want to highlight two different colors....but what if I have thousands of different items in the slicer?

amitchandak
Super User
Super User

@8shipsbynight , Based on what I got

 

Enable this option, After the press ctrl or Shift and you will be able select multiple point on scatter(click and drag) , they will get filtered on other visuals 

 

amitchandak_0-1644899440509.png

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I'm looking for something more like this https://community.powerbi.com/t5/Desktop/Scatter-Plot-Highlight-data-point-via-Slicer/m-p/890895

 

The slicer is what determines the dots that get highlighted. 

 

The solution in the link above is great, but doesn't incorporate more than 1 slicer. My PBI report will filter on a customer first, then a product. And when I select a product, I want those dots associated to the product to be a different color on the scatter plot. Is this feasible?

 

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.