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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dobregon
Impactful Individual
Impactful Individual

Slicer to hide or unhide measures in a line chart

Hi guys,

 

I have in my pbi a line chart with 6 measures, but my client want to have the possibility (using an slicer) to select if he wants to see all the measures or select in the slicers what measures needs to see.

 

is it possible?

i have done a trial, creating an external table with the name of the measures and then trying to use the meausres with the hasonfilter and switch example

 

IF(HASONEFILTER(Table1[Column1]),
    SWITCH(SELECTEDVALUE(Table1[Column1]),
        "Expected",Values[Expected]
        
     ),
  Blank()
  )

 

but this only run when i select only one option in the slicer, if i select 2 measures this function doesnt run

can someone help me on this?




Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
1 ACCEPTED SOLUTION

@dobregon it should be pretty straight forward, here is an example, let's you have 3 measures , YTD/QTD/MTD and a slicer table with 3 options:

 

MTD
QTD

YTD

 

so in the visual we want to show the values of selection in the slicer and if nothing is selected, all 3 will be shown (this behaviour can be changed) but let's we are going with this behaviour when nothing is selected:

 

Change each measure as below:

 

MTD Measure = 
VAR __show = IF( "MTD" IN VALUES( 'Slice'[SlicerSelection] ) , 1 )
RETURN 
<your existing MTD Measure calculateion>  * __show

QTD Measure = 
VAR __show = IF( "QTD" IN VALUES( 'Slice'[SlicerSelection] ) , 1 )
RETURN 
<your existing QTD Measure calculateion>  * __show

YTD Measure = 
VAR __show = IF( "YTD" IN VALUES( 'Slice'[SlicerSelection] ) , 1 )
RETURN 
<your existing YTD Measure calculateion>  * __show

 

you will see measure based on the selection in the slicer. You can tweak/change as per your need.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@dobregon , Actually you have to make it blank().

This example changes the measure but you have to make it blank , in place of other measures

https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...

Thanks @amitchandak  but it is what i tried. The problem is that i can select at the same time (MTD,QTD) because i will not see nothing.

This example is to select one type of measure. but in reality i have 5 measures and i want to select 1, 2, 3 or all measures to see in the chart.



Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

@dobregon it should be pretty straight forward, here is an example, let's you have 3 measures , YTD/QTD/MTD and a slicer table with 3 options:

 

MTD
QTD

YTD

 

so in the visual we want to show the values of selection in the slicer and if nothing is selected, all 3 will be shown (this behaviour can be changed) but let's we are going with this behaviour when nothing is selected:

 

Change each measure as below:

 

MTD Measure = 
VAR __show = IF( "MTD" IN VALUES( 'Slice'[SlicerSelection] ) , 1 )
RETURN 
<your existing MTD Measure calculateion>  * __show

QTD Measure = 
VAR __show = IF( "QTD" IN VALUES( 'Slice'[SlicerSelection] ) , 1 )
RETURN 
<your existing QTD Measure calculateion>  * __show

YTD Measure = 
VAR __show = IF( "YTD" IN VALUES( 'Slice'[SlicerSelection] ) , 1 )
RETURN 
<your existing YTD Measure calculateion>  * __show

 

you will see measure based on the selection in the slicer. You can tweak/change as per your need.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I am trying to follow along.  I have a departed employee who has applied this.  Problem is that i cannot seem to locate this measure in my report.  Can they hide this measure?

dobregon
Impactful Individual
Impactful Individual

@parry2k thanks! very simple and it runs! 



Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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