Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I’m trying to calculate YTD for last year same period 2016 - 2017. I’ve tried several different things and all are giving me a full year’s total for 2016 and not January – July 2016. Here are the calculations I’ve tried:
UnitsLY = CALCULATE([TotalUnits],DATEADD(dimDate[Date],-1,YEAR))
SamePeriod = CALCULATE([YTDUnits],SAMEPERIODLASTYEAR(dimDate[Date]))
Parallel = CALCULATE([TotalUnits],PARALLELPERIOD(dimDate[Date],-1,YEAR))
My fact table and date table are joined on ‘Date’ not a DateKey.
Is someone able to tell me what I’m doing wrong and why I’m getting all of 2016 and not just the same period January – July?
It would be better if you could show us a complete example. Try to use the DATESYTD Function.
DATESYTD ( SAMEPERIODLASTYEAR ( dimDate[Date] ) )
Here's a link to the file (hopefully this works, I'm new to the community and haven't tried doing this before.)
Take a close look at this article to learn more about DATESYTD.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
93 | |
90 | |
84 | |
70 | |
49 |
User | Count |
---|---|
141 | |
121 | |
112 | |
59 | |
58 |