Forum Discussion
Cmuglioni
4 years agoFrequent Visitor
SAMEPERIODLASTYEAR - Total Problem and Partial Solution
Hi Everyone, Let me explain my issue: I am looking to have the amount of wine cases (#Cajas) of the same period last year. Of course I used the following Dax Sentence and it works fine with detai...
- 4 years ago
Cmuglioni , Power bi recalculate, grand total. As there is no date selected. It is 1 year behind the measure of the duration available. I think it is summing up everything before 1 year from the end date of the calendar in the grand total. The other one forces a range. so it is working in that case
ValtteriN
Community Champion
4 years agoHi,
The total in table visual works in somewhat counter-intuituve way. I recommend checking this post by SQLBI to understand what is going on: https://www.sqlbi.com/articles/summing-values-for-the-total/
My first instinct to improve your dax would be to use SUMX or perhaps do something with ALLSELECTED.
So perhaps something like: CALCULATE([Cajas],SAMEPERIODLASTYEAR(Calendario[Fecha]),ALLSELECTED(Calendario[Fecha]))