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
Anonymous
Not applicable

Highlight bubble in a Scatter chart based of Slicer

I have read a lot of Highlight in a chart but none addresses the issue I am having.
I have a table called Project and also created a disconnected table called SelectedProject, consist of Projectname.
In the Project table, I have two measure to use for Scatter visual and they are called SPI and CPI and columns name called RAG, projectname and ProjectAmount
In the scatter chart, CPI is on the x-axis and SPI on the y axis and Projectamount is on te Size. The RAG has 3 colour values (RED, GREEN, AMBER) and I used this to format the colour of the bubbles.
The Issue I am having is that how can I highlight a bubble when a projectname is selected from the slicer and when highlighted it should retain the RAG colour and other bubble still retain there RAG colour but faded on the background.


Project table looks like below

ProjectIDProjectNameRAGProjectamountCPI SPI
1LandProRED1200.90.6
2GlutterRED2000.50.8
3StreetFillGREEN3200.10.7
4RoofAMBER5550.30.6
5Windows settingAMBER5600.70.5
6Tile PurchaseGREEN7001.10.4
7Other ItemsRED5201.50.3

How can I achieve this using the above table?

Thanks

2 ACCEPTED SOLUTIONS

Hi, @Anonymous 

Thank you very much for your reply. This is mainly due to the fact that the AMBER in your original RAG column is not being recognized correctly. Because amber is a non-standard color in Power BI. Others, such as GREEN and RED, can be correctly identified. Here's how to improve:

BubbleColor1 = 
SWITCH(
    TRUE(),
    [IsSelected1] = 1, IF(VALUES(Project1[ProjectName]) IN SELECTCOLUMNS('SeletedProject1','SeletedProject1'[ProjectName]) ,
    SWITCH(TRUE(),
        [RAG2] = "RED",  "red",
        [RAG2] = "GREEN", "green",
        [RAG2] = "AMBER", "hsla(43,100%,50%,1)",
        "black"  -- Default color for other cases
    )
        ,
        SWITCH([RAG2],
            "RED","hsla(0,100%,80%,0.4)",
            "GREEN","hsla(0,100%,80%,0.4)",
            "AMBER","hsla(45,100%,50%,0.4)"
    
    )
    ),
    [RAG2] = "RED",  "red",
    [RAG2] = "GREEN", "green",
    [RAG2] = "AMBER", "hsla(43,100%,50%,1)",
    "black"  -- Default color for other cases
)

Here are the results:

vjianpengmsft_0-1716263078764.png

I've uploaded the PBIX file I used this time below.

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

Anonymous
Not applicable

@v-jianpeng-msft Please, is there a way to ensure not only the Slicer that filter in scatter chart

tek01_0-1716368546555.png

So when clicked on Table or Funnel chart, this will perform the way in slicer is doing.
Click on any projectName on table or Funnel visual and Highlight the project selected on the scatter chart

View solution in original post

9 REPLIES 9
v-jianpeng-msft
Community Support
Community Support

Hi, @Anonymous 

Based on your description, I have created the two tables you said as follows:

vjianpengmsft_0-1715923334928.png

vjianpengmsft_1-1715923352424.png

I've created two metrics using the following DAX expression to determine if the current slicer is selected and to calculate the color for the current item.

IsSelected = IF(ISFILTERED('SelectedProject'[ProjectName]), 1, 0)
RAG1 = CALCULATE(SELECTEDVALUE(Project[RAG]),'Project'[Projectamount]=SELECTEDVALUE(Project[Projectamount])) 

Then I created a color gradient along with the highlighted metrics as follows:

BubbleColor = 
SWITCH(
    TRUE(),
    [IsSelected] = 1, IF(VALUES(Project[ProjectName]) IN SELECTCOLUMNS('SelectedProject','SelectedProject'[ProjectName]) ,[RAG1],
        SWITCH([RAG1],
            "RED","hsla(0,100%,80%,0.4)",
            "GREEN","hsla(0,100%,80%,0.4)",
            "AMBER","hsla(240,100%,80%,0.4)"
    
    )
    ),
    [RAG1] = "RED",  "red",
    [RAG1] = "GREEN", "green",
    [RAG1] = "AMBER", "AMBER",
    "black"  -- Default color for other cases
)

After that, you need to apply it in the conditional formatting of the bubble map:

vjianpengmsft_2-1715923935880.png

vjianpengmsft_3-1715923948069.png

Then create a slicer and select the corresponding items, which will show the original color, and the other items will have their original color. Here are the results:

Unchecked Status:

vjianpengmsft_4-1715924035281.png

 

Project Selected Status:

vjianpengmsft_5-1715924065880.png

vjianpengmsft_6-1715924118874.png

Although it is not possible to adjust the size of each bubble using a DAX expression, it is possible to adjust the color gradient of the bubble using the DAX. I've provided the PBIX used this time below.

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks for your reply.
It didn't work because I didn't explain properly.
I have tried to attach sample data but was blocked.
Let me explain better this time.

ProjectIDProjectNameRAGProjectamountBCWPACWPBCWS
1LandProRED120450035005000
2GlutterRED200633050009500
3StreetFillGREEN3208222450410000
4RoofAMBER555500025005200
5Windows settingAMBER560450420553990
6Tile PurchaseGREEN700550036007000
7Other ItemsRED520655245006900


CPI and SPI are measures and are calcluated as follows:
CPI = Divide(Sum(Project[ACWP]), Sum(Project[BCWS]))
SPI = Divide(Sum(Project[BCWP]), Sum(Project[BCWS]))

This measure are put CPI in x-axis and SPI in y_axis, ProjectName in the Values and Projectamount in Size as shown below

tek01_0-1715934257987.png

The RAG is used to colour the bubbles and there is a slicer called ProjectName.
So measures are used not columns.

Hi, @Anonymous 

Thank you very much for your reply. Based on the latest dataset you provided, I have created the following two tables:
project1:

vjianpengmsft_0-1715936004198.png

SeletedProject1:

vjianpengmsft_1-1715936016692.png

I created the following two measures: CPI and SPI:

vjianpengmsft_2-1715936091313.png

vjianpengmsft_3-1715936140258.png

 

In addition, I have created the following measures:

vjianpengmsft_4-1715936183282.png

vjianpengmsft_5-1715936196027.png

vjianpengmsft_6-1715936214752.png

 

The bubble chart settings are as follows:

vjianpengmsft_7-1715936307568.png

vjianpengmsft_10-1715936428211.pngvjianpengmsft_11-1715936452195.png

 

The slicer settings are as follows:

vjianpengmsft_8-1715936348796.png

Here are the results:

vjianpengmsft_9-1715936372855.png

vjianpengmsft_12-1715936507611.png

I've provided the PBIX file used this time below.

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Anonymous
Not applicable

Thanks for your quick response. It is working but one issue is that when I select Windows setting from the ProjectNamename slicer the bubble colour is blue instead of Amber

tek01_0-1715948845345.png

How can you help fix this?

 

Hi, @Anonymous 

Thank you very much for your reply. You can change the color value in the hsla parentheses in the DAX expression. The following is an amber color value reference:

vjianpengmsft_0-1716183393428.png

hsla(45, 100%, 50%, 1)

 You can tweak your colors more finely from the following websites:

HTML HSL and HSLA Colors (w3schools.com)

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks for your response. I have changed the HSL or HSLA colour for Amber but it is still showing blue colour when Windows setting and Roof are selected individually. see screenshot below

tek01_0-1716194054586.png

 

 

Hi, @Anonymous 

Thank you very much for your reply. This is mainly due to the fact that the AMBER in your original RAG column is not being recognized correctly. Because amber is a non-standard color in Power BI. Others, such as GREEN and RED, can be correctly identified. Here's how to improve:

BubbleColor1 = 
SWITCH(
    TRUE(),
    [IsSelected1] = 1, IF(VALUES(Project1[ProjectName]) IN SELECTCOLUMNS('SeletedProject1','SeletedProject1'[ProjectName]) ,
    SWITCH(TRUE(),
        [RAG2] = "RED",  "red",
        [RAG2] = "GREEN", "green",
        [RAG2] = "AMBER", "hsla(43,100%,50%,1)",
        "black"  -- Default color for other cases
    )
        ,
        SWITCH([RAG2],
            "RED","hsla(0,100%,80%,0.4)",
            "GREEN","hsla(0,100%,80%,0.4)",
            "AMBER","hsla(45,100%,50%,0.4)"
    
    )
    ),
    [RAG2] = "RED",  "red",
    [RAG2] = "GREEN", "green",
    [RAG2] = "AMBER", "hsla(43,100%,50%,1)",
    "black"  -- Default color for other cases
)

Here are the results:

vjianpengmsft_0-1716263078764.png

I've uploaded the PBIX file I used this time below.

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@v-jianpeng-msft  Thank you very much... I appreciate your knownledge and effort

Anonymous
Not applicable

@v-jianpeng-msft Please, is there a way to ensure not only the Slicer that filter in scatter chart

tek01_0-1716368546555.png

So when clicked on Table or Funnel chart, this will perform the way in slicer is doing.
Click on any projectName on table or Funnel visual and Highlight the project selected on the scatter chart

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors