Forum Discussion
using slicer date value in dax formula
- 4 years ago
Hi kaileena
in this case SELECTEDVALUE returns blank as it cannot find a single value of the date because you selecting a period (a month or multiple months) not a single date. Therefore as long as there is no blank dates in the Measurement Table, the filtered table will be empty. Therefore you need to use ALLSELECTED or VALUES to retrieve the selected dates, then you can use IN operator to check if current row date inside CALCULATE filter is within the selected period. Please try the following with either ALLSELECTED or VALUES
Value for Slicer Selected Month Budget Spent = CALCULATE ( SUM ( 'Measurement'[Value] ), 'Measurement'[Type] = "Budget Spent", Measurement[Full Format for Period] IN VALUES ( ForSlicer[Full Format for Period] ) )
Hi kaileena
in this case SELECTEDVALUE returns blank as it cannot find a single value of the date because you selecting a period (a month or multiple months) not a single date. Therefore as long as there is no blank dates in the Measurement Table, the filtered table will be empty. Therefore you need to use ALLSELECTED or VALUES to retrieve the selected dates, then you can use IN operator to check if current row date inside CALCULATE filter is within the selected period. Please try the following with either ALLSELECTED or VALUES
Value for Slicer Selected Month Budget Spent =
CALCULATE (
SUM ( 'Measurement'[Value] ),
'Measurement'[Type] = "Budget Spent",
Measurement[Full Format for Period]
IN VALUES ( ForSlicer[Full Format for Period] )
)