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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
colourfullife
Post Partisan
Post Partisan

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..

 

question.PNG

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@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

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

12 REPLIES 12
PaulDBrown
Community Champion
Community Champion

@colourfullife 

 

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'):

Create table.JPG

 

 

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:
Result.JPG

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown  Thanks for your reply.

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

Fowmy
Super User
Super User

@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

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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

after what do i need to do?

@colourfullife 

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


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy  yes, i thought i understood your steps and followed but the result doesn't come out like yours.

 

1. made a table

1111.PNG

 

2. added highlighted dax part in my origianl dax to link.

22222.PNG

 

did i miss something here?? if so please let me know.!

@colourfullife

Make sure you are typing the same value in the measure as in the Slicer Table "PO (CDD)", you have space at then like "PO (CDD) "

Hope you make a slicer and inserted the Slicer column there?

________________________

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

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy  thanks for your reply.

 

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

error message.PNG

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

 

thanks,

CL

@colourfullife 

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

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy  still got the same error message. 😞

is it because i didn't have a latest version of PBI? hmm

is there any way to share the file? i feel like you have what i am after! 

@colourfullife 

Send me your email to the private Message.

________________________

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

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

amitchandak
Super User
Super User

@colourfullife , 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-slic...
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

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