Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
lcannon
Frequent Visitor

Year over Year calcuations

Spoiler

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?

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@lcannon,

 

It would be better if you could show us a complete example. Try to use the DATESYTD Function.

DATESYTD ( SAMEPERIODLASTYEAR ( dimDate[Date] ) )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Here's a link to the file (hopefully this works, I'm new to the community and haven't tried doing this before.)

 

https://www.dropbox.com/s/gg58ik3adc8bmx6/2017.08.03%20Power%20BI%20Report%20for%20community.pbix?dl...

 

@lcannon,

 

Take a close look at this article to learn more about DATESYTD.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.