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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
cmazur71
New Member

How to use the value of a slider selection in a measure

I have a measure that uses the following formula:

TotalMoved =
CALCULATE(SUM('Volumes'[Dirt]),'Volumes'[Date]="FilterA")
 
The filter value of "FilterA" is selected from a slicer....other options are FilterB, FilterC, etc
I want to replace the "FilterA" in my measure with whatever value the user chooses in the slicer.  Is there a way to use the slicer selection in my measure, rather than hard-coding in a filter?
 
1 ACCEPTED SOLUTION
Shravan133
Solution Sage
Solution Sage

Try This: 

TotalMoved =
CALCULATE(
SUM('Volumes'[Dirt]),
'Volumes'[Date] = SELECTEDVALUE('FilterTable'[FilterColumn])
)

 

  1. SELECTEDVALUE('FilterTable'[FilterColumn]): This function retrieves the value selected from the slicer. You need to replace 'FilterTable'[FilterColumn] with the table and column where the filter values (e.g., FilterA, FilterB, FilterC) are stored. The slicer should be linked to this table and column.

  2. Dynamic Filtering: The slicer will update the measure based on the user’s selection, ensuring that 'Volumes'[Date] is dynamically filtered by the value chosen in the slicer (e.g., "FilterA", "FilterB", etc.).

 

  • Make sure the slicer is connected to the column ('FilterTable'[FilterColumn]) from which the filter values are pulled.
  • If no value is selected in the slicer, SELECTEDVALUE will return BLANK. You can handle this case by providing a default value or using ISBLANK() to add logic for what should happen when nothing is selected.

View solution in original post

2 REPLIES 2
cmazur71
New Member

How do you set the default value for the slicer?

Shravan133
Solution Sage
Solution Sage

Try This: 

TotalMoved =
CALCULATE(
SUM('Volumes'[Dirt]),
'Volumes'[Date] = SELECTEDVALUE('FilterTable'[FilterColumn])
)

 

  1. SELECTEDVALUE('FilterTable'[FilterColumn]): This function retrieves the value selected from the slicer. You need to replace 'FilterTable'[FilterColumn] with the table and column where the filter values (e.g., FilterA, FilterB, FilterC) are stored. The slicer should be linked to this table and column.

  2. Dynamic Filtering: The slicer will update the measure based on the user’s selection, ensuring that 'Volumes'[Date] is dynamically filtered by the value chosen in the slicer (e.g., "FilterA", "FilterB", etc.).

 

  • Make sure the slicer is connected to the column ('FilterTable'[FilterColumn]) from which the filter values are pulled.
  • If no value is selected in the slicer, SELECTEDVALUE will return BLANK. You can handle this case by providing a default value or using ISBLANK() to add logic for what should happen when nothing is selected.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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