Forum Discussion

r4v3n's avatar
r4v3n
New Member
3 years ago
Solved

Add a selectable legend to multiple Y-axis series chart ?

Hi,

 

I could not find a proper documentation on how to realize this very simple task.

 

The data model looks like this : 

 

 

Each column holds the count of a category over time, i am trying to represent in the chart, like so : 

 

 

The goal is to make each series selectable/hideable through a legend or slicer. 

 

So if i only tick category A, the chart would only display that series. 

 

What is the proper way of achieving this on Desktop ? 

 

Thanks ! 

 

 

 

 

  • Ok so i was able to figure it out, here's how you can modify the previous DAX to include for multiple selections : 

     

    Value1 =
    IF (
        LASTNONBLANK ( 'Select'[Select], 1 ) = "Value1",
        LASTNONBLANK ( 'total per row'[expected], 1 ),
        IF (
            CONTAINS(ALLSELECTED('Select'[Select]), [Select], "Value1"),
            LASTNONBLANK ( 'total per row'[expected], 1 ),
            BLANK ()
        )
    )

     

    Basically saying, display Liner Value 1 if it's the lastnonblank or if it's in the list of selected filters for the select column category. 

     

    Could probably get rid the first if conditional imo, but was just trying to quickly fix the problem. 

     

    Hopefully this helps anyone that goes through same problem in the future. 

3 Replies

  • I have found this topic which offers the closest solution to my use case : Solved: Line chart slicer - Microsoft Power BI Community 

     

    Currently, when selecting multiple filters at once, only one liner displays, instead i would like to have every selected filter display the corresponding liner. 

     

    I have the multi-select option enabled on the slicer settings : 

     

     

    This has to do with the following DAX request : 

     

    Value1 =
    IF (
        LASTNONBLANK ( 'Select'[Select], 1 ) = "Value1",
        LASTNONBLANK ( 'total per row'[expected], 1 ),
        IF (
            ISFILTERED ( 'Select'[Select] ) = FALSE (),
            LASTNONBLANK ( 'total per row'[expected], 1 ),
            BLANK ()
        )
    )

     

    Essentially how to modify the previous query, to allow for multiple filtering to display all the selected liners at once ? 

    • r4v3n's avatar
      r4v3n
      New Member

      Ok so i was able to figure it out, here's how you can modify the previous DAX to include for multiple selections : 

       

      Value1 =
      IF (
          LASTNONBLANK ( 'Select'[Select], 1 ) = "Value1",
          LASTNONBLANK ( 'total per row'[expected], 1 ),
          IF (
              CONTAINS(ALLSELECTED('Select'[Select]), [Select], "Value1"),
              LASTNONBLANK ( 'total per row'[expected], 1 ),
              BLANK ()
          )
      )

       

      Basically saying, display Liner Value 1 if it's the lastnonblank or if it's in the list of selected filters for the select column category. 

       

      Could probably get rid the first if conditional imo, but was just trying to quickly fix the problem. 

       

      Hopefully this helps anyone that goes through same problem in the future. 

      • v-chenwuz-msft's avatar
        v-chenwuz-msft
        Icon for Community Support rankCommunity Support

        Hi r4v3n ,

         

        Thanks for your sharing, please mark your reply as the solution, so that others can find it quickly.

         

        Best Regards

        Community Support Team _ chenwu zhu