Forum Discussion
Letting user set date variable for calculated measures
- 7 years ago
Use the SELECTEDVALUE function:
https://www.sqlbi.com/articles/using-the-selectedvalue-function-in-dax/
https://community.powerbi.com/t5/Desktop/Use-selectedvalue-in-a-measure/td-p/483456
I use a slicer for dates and allow them to pick a single date or a date range. That value then becomes the selected value for the measure.
Hi JoyCornerstone, thanks - is that a normal slicer or a parameter slicer? How did you set the data type to "date"?
- JoyCornerstone7 years ago
Resolver II
A normal slicer. In your data model, you should have a Calendar table that contains a date range for the set of dates in your system. If you don't have that, you'll need to go search for how to set that up and connect it to your underlying table.
- Anonymous7 years agoNot applicable
Thanks JoyCornerstone , sorry but how do you get the selected value into a parameter/measure? If I create a slicer doesn't that just filter the underlying tables?
- JoyCornerstone7 years ago
Resolver II
Use the SELECTEDVALUE function:
https://www.sqlbi.com/articles/using-the-selectedvalue-function-in-dax/
https://community.powerbi.com/t5/Desktop/Use-selectedvalue-in-a-measure/td-p/483456