Forum Discussion
Create dynamic measure based on slicer selection
- 2 years ago
otto-user101 , To achieve your goal of creating a dynamic measure that responds to slicer selections, it's essential to use a disconnected date table for the slicer. This ensures that your measure can respond independently to the slicer selection without being directly tied to the dates in your base table.
Then you can have measures like
Dynamic Measure =
VAR SelectedDate = SELECTEDVALUE(DisconnectedDateTable[Date])
VAR MaxDate = CALCULATE(MAX(BaseTable[Date]), ALL(BaseTable))
RETURN
SWITCH(
TRUE(),
SelectedDate = MaxDate && BaseTable[Identifier] = "Possible", "Possible",
SelectedDate <> MaxDate && NOT CONTAINSSTRING(BaseTable[Identifier], "Scenario"), "All",
BLANK()
) - 2 years ago
Hi otto-user101 ,
Please try below steps:
1.below is my test tableBase 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 _result3. 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.
v-lulu2-msft amitchandak I appreciate your help! I submitted another question to better explain my desired outcome.