Forum Discussion
Paulo123
4 years agoFrequent Visitor
Running Total lastyear
hi, I wanted the measure to return the accumulated value of the last year. but when I filter for example the year 2021, it should return the accumulated value for the year 2020 but it returns blank....
- 4 years ago
Hi,
I recommend creating a normal RT calculation like:
RT =CALCULATE (SUM (Dados[Mês])ALLSELECTED ( Dados), Dados[Data Valor] <= MAX(CALENDARIO[Date]))
Then create LY measure like this:
[RT LY] =
CALCULATE([RT],SAMEPERIODLASTYEAR(CALENDARIO[Date]))
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/ - 4 years ago
Sorry about that, Here is a revised version:
RT =
var maxdate = MAX(CALENDARIO[Date]) returnCALCULATE (SUM (Dados[Mês])ALL( CALENDARIO), CALENDARIO[Date] <= maxdate)
Also for future reference check this article by SQLBI about the topic: https://www.sqlbi.com/articles/computing-running-totals-in-dax/ - 4 years ago
Hi Paulo123 ,
Sorry, It's hard to give an accurate formula without detail information. SAMEPERIODLASTYEAR works well in my model. Please refer to this pbix
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ValtteriN
Community Champion
4 years agoSorry about that, Here is a revised version:
RT =
var maxdate = MAX(CALENDARIO[Date]) return
CALCULATE (SUM (Dados[Mês])
ALL( CALENDARIO), CALENDARIO[Date] <= maxdate
)
Also for future reference check this article by SQLBI about the topic: https://www.sqlbi.com/articles/computing-running-totals-in-dax/
Also for future reference check this article by SQLBI about the topic: https://www.sqlbi.com/articles/computing-running-totals-in-dax/