Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Slicer

Hi Masters,

 

I have a grpah with multiple lines created by dax with each data columns like below.

Now what i want is having a slicer of each lines. I want to show one line in the graph using the slicer.

is it possible? if so please help me out..

 

  • @colourfullife

    Yes, it is possible. Since you have a measure for each line in the graph, create a table using the Enter Data option on the Home ribbon. Enter All the measure names that you use in the charts. Insert a slicer and drop the measure names.

    Modify each measure to check if the particular measure is selected in white, this way you can select what to display on the chart.
    You can even select multiple measures.

     

    You can download the file : https://1drv.ms/u/s!AmoScH5srsIYgYYwi9h4WbIw8meNxw?e=cRbXdT

    ________________________

    If my answer was helpful, please consider Accepting it as the solution to help other members find it

    Click the Thumbs-Up icon if you like thisπŸ™‚πŸ™‚

    Youtube Linkedin

     

     

12 Replies

  • @colourfullife

    Yes, it is possible. Since you have a measure for each line in the graph, create a table using the Enter Data option on the Home ribbon. Enter All the measure names that you use in the charts. Insert a slicer and drop the measure names.

    Modify each measure to check if the particular measure is selected in white, this way you can select what to display on the chart.
    You can even select multiple measures.

     

    You can download the file : https://1drv.ms/u/s!AmoScH5srsIYgYYwi9h4WbIw8meNxw?e=cRbXdT

    ________________________

    If my answer was helpful, please consider Accepting it as the solution to help other members find it

    Click the Thumbs-Up icon if you like thisπŸ™‚πŸ™‚

    Youtube Linkedin

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Fowmy  thanks for your reply.

       

      I tried to open the link but got this error message..

      and can you please let me know which video i need to refer in the youtube channel ?

       

      thanks,

      CL

      • Fowmy's avatar
        Fowmy
        Super User

        Anonymous 

        Can you check the link now?

        ________________________

        If my answer was helpful, please consider Accept it as the solution to help the other members find it

        Click on the Thumbs-Up icon if you like this reply πŸ™‚

        YouTube  LinkedIn

    • Anonymous's avatar
      Anonymous
      Not applicable

      Fowmy  i made a table using enter data in home tab.

      after what do i need to do?

      • Fowmy's avatar
        Fowmy
        Super User

        Anonymous 

        Modify each measure to include the condition to show the selected measure. Check my file and you will understand how it works.
        I provided the steps in my original reply.

        ________________________

        If my answer was helpful, please consider Accept it as the solution to help the other members find it

        Click on the Thumbs-Up icon if you like this reply πŸ™‚

        YouTube  LinkedIn


  • Anonymous , This one is tricky.

    if the line is because of legend, create a slicer on the legend

     

    So you need control multiple lines with the slicer

     

    line 1 measure =
    var _max =maxx(Filter(allselected(Slicer[value]),Slicer[value] ="Line1"), [Value])
    return
    if(_max = null , blank(), [measure])

     

    line 2 measure =
    var _max =maxx(Filter(allselected(Slicer[value]),Slicer[value] ="Line2"), [Value])
    return
    if(_max = null , blank(), [measure])

     

    if need one line at a time , refer

    https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slicer-parameter-table-pattern
    https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/500115

     

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    Anonymous 

     

    Here is one way of doing this.

    1) create a new table with the names of your measures by selecting the "Enter Data" option in the Home tab in the ribbon. For my example I'm working with 4 measures, so here is my new table (I've called it 'Slicer by measure'):

     

     

    2) now create a new measure which will deliver the measure based on the selection made in the new slicer:

     

    Selected Measure by Slicer = SWITCH(TRUE(),
        SELECTEDVALUE('Slicer by measure'[Name Measure]) IN {"Sales for 1A"}, [Sales for 1A],
            SELECTEDVALUE('Slicer by measure'[Name Measure]) IN {"Sales for 2B"}, [Sales for 2B],
                SELECTEDVALUE('Slicer by measure'[Name Measure]) IN {"Sales for 3C"}, [Sales for 3C],
                    [Sales for 4D])

     

     

    3) Create you line chart using this last measure, [Selected Meaure by Slicer], add the slicer to the page, and you get this:

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      PaulDBrown  Thanks for your reply.

      one question, can i put 2 lines in the graph using the filter?