Forum Discussion
Related filtering with years
- Anonymous8 years ago
The following measure should work:
OriginSales =
VAR SlicerYear =
SELECTEDVALUE ( CalendarTable[Year] )
RETURN
CALCULATE ( [TotSales], SalesTable[Origin Year] = SlicerYear )We create a variable called SlicerYear that stores the current value from the slicer.
We then modify the filter context by using CALCULATE(), and specify that we want SalesTable[OriginYear] to equal the stored SlicerYear value.
All the best,
~ Chris H
Hi Anonymous do you know how can i replace SELECTEDVALUE for a valid function in a tabular model on SSAS ? Because it doesn't recognize SELECTEDVALUE as a valid function.
You must have an earlier version of SSAS, no worries.
Replace SELECTEDVALUE() with MIN(). It will accomplish the same thing; it will return the smallest year value in the current filter context.
If nothing is selected in the slicer, it will return the first year. If the slicer is set to Year = 2017, then the only value in the current filter context is 2017, so MIN() will return 2017.