Forum Discussion
Anonymous
6 years agoNot applicable
Dynamic last december measure
Hi everyone,
I'm working on a measure to calculate the last December value so my measure is :
Total = CALCULATE(SUM('QPTOTAL'[Revenue]))
Last December = CALCULATE(CALCULATE([Total],LASTDATE('Calendar'[Year/Month])),PARALLELPERIOD('Calendar'[Year/Month],-1,YEAR))
Do you have any idea to ameliorate this measure to a dynamic Last December, so I can have as result Last December 2018 Last December 2017 ..... When I select the year as a filter.
Best regards.
Thank you
- Anonymous6 years ago
Hi Anonymous
Please try this measure and check if it works for youMeasure = VAR _selectedYear = SELECTEDVALUE('Table'[Date].[Year])-1 RETURN CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),YEAR('Table'[Date])=_selectedYear && MONTH('Table'[Date])=12))
2 Replies
- AnonymousNot applicable
Hi Anonymous
Please try this measure and check if it works for youMeasure = VAR _selectedYear = SELECTEDVALUE('Table'[Date].[Year])-1 RETURN CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),YEAR('Table'[Date])=_selectedYear && MONTH('Table'[Date])=12))- ed144Regular Visitor
Thanks Anonymous . I am facing the exact same issue. Your code works, but it sums the previous december value for my whole dataset. How can I make the measure account for the filters I apply in my report?