Forum Discussion
otto-user101
2 years agoFrequent Visitor
Create dynamic measure based on slicer selection
I'm looking to create a measure that will populate based on a slicer selection. This measure will eventually be used as a slicer. Can anyone illuminate me on how to achieve this using DAX? Base T...
v-lulu2-msft
2 years agoMicrosoft Employee
Hi otto-user101 ,
Please try below steps:
1.below is my test table
Base Table:
Table:
Table = CALENDAR(FIRSTDATE('Base Table'[Date]),LASTDATE('Base Table'[Date]))
2. create a meausre with below dax formula
Measure =
VAR _a =
SELECTEDVALUE ( 'Table'[Date] )
VAR _b =
SELECTEDVALUE ( 'Base Table'[Date] )
VAR _c =
SELECTEDVALUE ( 'Base Table'[Identifier] )
VAR _result =
SWITCH (
TRUE (),
_a = _b, _c,
_a <> _b
&& NOT ( CONTAINSSTRING ( _c, "Scenario" ) ), "All",
BLANK ()
)
RETURN
_result
3. add a table visual with Base Table fields and measure, add a slicer visual with Table field
Best Regards,
Liz Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.