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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
acg
Resolver I
Resolver I

Scatterplot with 4 custom colours on select?

I am working with a bunch of entities, and conducted a ML project. Some entities emerged as outliers and are cathegorised as flagged, the rest is unflagged. 

I have a table with entity number and name, which should drive a scatterplot.

In this scatterplot I have two options on the x axis, that is flagged and not flagged. 

When I select an entity on the table I wanted this entotu to be highlighted in the scatterplot along with all other entities- which should appear in a dim colour.  I tried the below code, and use it in Legend. However, I simply cannot get it working properly. I also cannot use Marker, It does not show up the conditions noted below as in selction and flagged versus non flagged. 

Does anyone know of a similiar example? 

VAR SelectedEntities = ALLSELECTED(FAP_RegReturn_PowerBI_T3[FSP Number]) // Selected entities in slicer

VAR ThisEntity = 'FAP_RegReturn_PowerBI_T3'[FSP Number]

VAR IsSelected = CONTAINS(SelectedEntities, [FSP Number], ThisEntity)

VAR IsFlagged = 'FAP_RegReturn_PowerBI_T3'[Final_Outlier] = TRUE()

RETURN

SWITCH(

    TRUE(),

    IsSelected && IsFlagged, "Dark Grey",       // Selected & Flagged

    IsSelected && NOT IsFlagged, "Dark Green",  // Selected & Not Flagged

    NOT IsSelected && IsFlagged, "Light Grey",  // Not Selected & Flagged

    NOT IsSelected && NOT IsFlagged, "Light Green"  // Not Selected & Not Flagged

)

 

 

 

 

1 ACCEPTED SOLUTION
v-hjannapu
Community Support
Community Support

Hi @acg 
Thank you  for reaching out to the Microsoft fabric community forum.


You can solve this by creating a separate table for selecting the entity, so it doesn’t filter the main data. Then use a DAX formula to set colours based on which entity is selected and whether it's flagged or not. This way, all entities will always show in the scatterplot selected one in dark colour, others in light colour. Just use EntityColor in legend, and FlagStatus on X-axis and Score on Y-axis. It will work exactly like you want.
Instead of using a table, I suggest using a slicer to select the entity. It will help show all entities in the scatterplot with correct highlight and color logic as you expected.

I tested it with my sample data, and it worked fine. Please find the attached Pbix for your reference and gothrough with this link it may help you regarding issue:
Solved: Change color of scatter depending on selection fro... - Microsoft Fabric Community
I hope this helped Feel free to ask any further questions. If this resolved your issue, please mark it as "Accept as Solution" and give us Kudos to assist others.

Regards,
Harshitha.

View solution in original post

2 REPLIES 2
v-hjannapu
Community Support
Community Support

Hi @acg 
Thank you  for reaching out to the Microsoft fabric community forum.


You can solve this by creating a separate table for selecting the entity, so it doesn’t filter the main data. Then use a DAX formula to set colours based on which entity is selected and whether it's flagged or not. This way, all entities will always show in the scatterplot selected one in dark colour, others in light colour. Just use EntityColor in legend, and FlagStatus on X-axis and Score on Y-axis. It will work exactly like you want.
Instead of using a table, I suggest using a slicer to select the entity. It will help show all entities in the scatterplot with correct highlight and color logic as you expected.

I tested it with my sample data, and it worked fine. Please find the attached Pbix for your reference and gothrough with this link it may help you regarding issue:
Solved: Change color of scatter depending on selection fro... - Microsoft Fabric Community
I hope this helped Feel free to ask any further questions. If this resolved your issue, please mark it as "Accept as Solution" and give us Kudos to assist others.

Regards,
Harshitha.

Excellent, thank you!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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