Forum Discussion

sajLGBI's avatar
sajLGBI
Frequent Visitor
1 year ago
Solved

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.


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.

  • 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"
    )
    

     

5 Replies

  • 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 

    • sajLGBI's avatar
      sajLGBI
      Frequent Visitor

      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 

       

      • danextian's avatar
        danextian
        Super User

        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"
        )
        

         

  • Anonymous's avatar
    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!