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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
sajLGBI
New Member

Dynamic Legend on line chart - selected entity

Hi, I've got a list of entities (could be schools; factories; areas) and the user selected the 'focus' entity.
A table on the left hand side returns a series of classifications with value breakdowns - sales; costs etc.

I want to have a line chart or scatter chart that shows all values for the group of entities but highlights the selected focus entity so the user can see the trend of costs over financial years in comparison with other entities - based on selection - areas and/or size and / or turnover. 

This has been produced as a line chart (lines turned off) and ALL series set as small then a specific entity set as large and orange. The entity is the legend hence all the points but it's not dynamic. I want the highlighted block to update if the user selects a different focus entity.

I know I cannot use a measure to set the legend but I've got that working succcessfully in tables as I can format background colour etc based on a measure but line charts and scatter charts don't have that flexibility.

sajLGBI_0-1733570218871.png


Any ideas as to how I may be able to achieve this.
I like the individual dots as that shows any gaps rather than just a bar showing the min / max.

1 ACCEPTED SOLUTION

Hi @sajLGBI 

 

You can use a disconnected table then a measure as conditional formatting to change the color of selected categories. Example:

Marker Color = 
IF (
    NOT (
        ISBLANK (
            CALCULATE (
                COUNTROWS ( 'Sales' ),
                KEEPFILTERS (
                    TREATAS ( VALUES ( 'Selected Region'[Region] ), 'Sales Territory'[Region] )
                )
            )
        )
    ),
    "red",
    "#4d4b47"
)

danextian_0-1733811665196.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @sajLGBI ,

Is my follow-up just to ask if the problem has been solved?

If so, can you accept the correct answer as a solution or share your solution to help other members find it faster?

Thank you very much for your cooperation!

danextian
Super User
Super User

Hi @sajLGBI 

 

I am not exactly sure what you want to achieve as there is no sample data and your expected result from that. But if you want to use a measure as a legend you will need a disconnected table that has the desired legend and a measure to distribute the value across these legends. Check if this works for you

https://youtu.be/dEuDlcSzk7k 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi. Thanks for the example.

 

Not quite. For example each dot on the grapnh is a store, the X axis are financial years and the Y axis is value, eg sales.

 

Select a 'focus' store via a slicer and the graph highlights the focus store within the dots.

 

Thanks 

 

Hi @sajLGBI 

 

You can use a disconnected table then a measure as conditional formatting to change the color of selected categories. Example:

Marker Color = 
IF (
    NOT (
        ISBLANK (
            CALCULATE (
                COUNTROWS ( 'Sales' ),
                KEEPFILTERS (
                    TREATAS ( VALUES ( 'Selected Region'[Region] ), 'Sales Territory'[Region] )
                )
            )
        )
    ),
    "red",
    "#4d4b47"
)

danextian_0-1733811665196.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Ahhh, you set the scatter chart to have a continuous X axis. Then it allows you to conditionally set the colour.

 

I was using textual financial years so that option disappears.

I will be able to display the FY numerically... et voila.

 

Many thanks

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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