Forum Discussion
Anonymous
6 years agoNot applicable
Show previous values for the selected slicer value
Hello All I need some help with the following satiation I have to show the previous months values when I select a month from the slicer (the month order is from July 2019 to June 2020) If I select...
v-xuding-msft
Community Support
6 years agoHi Anonymous ,
I created a sample. Please have a try to check if it is what you want.
Measure =
VAR SelectedMonth =
SELECTEDVALUE ( 'Month'[MonthNo.] )
VAR SelectedYear =
IF ( SelectedMonth <= 6, 2020, 2019 )
RETURN
SWITCH(SelectedYear,
2019,
CALCULATE (
SUM ( 'Table'[METRIC_VALUE_MTM] ),
FILTER (
'Table',
'Table'[Year] = SelectedYear
&& 'Table'[MonthNo.] <= SelectedMonth
)
),
2020,
CALCULATE (
SUM ( 'Table'[METRIC_VALUE_MTM] ),
FILTER (
'Table',
'Table'[Year] = SelectedYear
&& 'Table'[MonthNo.] <= SelectedMonth
)
)
+ CALCULATE (
SUM ( 'Table'[METRIC_VALUE_MTM] ),
'Table'[Year] = SelectedYear - 1
)
)
For more details, please download the attachment below.
Anonymous
6 years agoNot applicable
Hi there,
Thanks for the approach,
But the data table I was shown is just an example I have multiple years of data not just 2019 and 2020
can we keep the year dynamic not just to limit that to 2019 and 2020