Forum Discussion
Anonymous
6 years agoNot applicable
Total problem with SAMEPERIODLASTYEAR
I have been struggling for some time now with this small&easy(?) problem.. ☹️ Measure: Diff sales between years = IF ( ISBLANK([Total sales last year]); BLANK(); [Total sales (SU...
- 6 years ago
Hi , Anonymous
Not very clear .
Maybe what you need is a formula like this:2Diff sales between years = SUMX(DISTINCT('Date'[Date]), IF ( ISBLANK([Total sales last year]), BLANK(), [Total sales] - [Total sales last year] ))Here is a demo.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
6 years agoNot applicable
Sorry I can't get it to work. I am new to DAX (but been working a lot with Excel in the past)
I created a caledar :
Calendar = CALENDARAUTO()
and change :
Total sales last year =
CALCULATE([Total sales (SUMX)]; SAMEPERIODLASTYEAR('Calendar'[Date])
)
Then I get the result :
Date in the table picture is the date from the data table. Not Calendar Date.
Date in the table picture is the date from the data table. Not Calendar Date.
Anonymous
6 years agoNot applicable
Please learn the correct data modeling techniques:
https://www.youtube.com/watch?v=_quTwyvDfG0
https://www.youtube.com/watch?v=78d6mwR8GtA&t=1247s
https://www.sqlbi.com/tv/time-intelligence-in-microsoft-power-bi/
And remember: Power BI is not Excel. DAX is simple but it's not easy.
Best
D
https://www.youtube.com/watch?v=_quTwyvDfG0
https://www.youtube.com/watch?v=78d6mwR8GtA&t=1247s
https://www.sqlbi.com/tv/time-intelligence-in-microsoft-power-bi/
And remember: Power BI is not Excel. DAX is simple but it's not easy.
Best
D