Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
98 | |
78 | |
65 | |
53 |
User | Count |
---|---|
144 | |
103 | |
98 | |
85 | |
64 |