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

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.

Reply
sinadvd
New Member

YTD calculation with SamePeriodLastYear brings back same values

Hello everyone, 
I'm trying to simulate an exercise from Microsoft PowerBi course in EDX.org, about using meassures and more specifically YTD and SamePeriodLast Year command. 

 

The powerbi project file provided by the course is here : Github Download Link 

Using these data, by  applying DAX commands for YTD Revenue  and LY YTD as below, the numbers I get back are the same for both years which makes the calculation for YTD Variance to be zero.

YTD Revenue = TOTALYTD(SUM(Sales[REevenue]),'Date'[Date])

YTD LY = CALCULATE([YTD Revenue],SAMEPERIODLASTYEAR('Date'[Date]))

 

YTD Var = [YTD Revenue] - [LY YTD]

Annotation 2020-04-21 154803.png

 

I would appriciate if you can help me with choosing the right Date table and fixing the LY YTD

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@sinadvd , looking at screenshot , I doubt either the join with date table is disabled or not there. Please check the join.

Make sure the date table is marked as the date .

The formula seems correct for LY you can also try

YTD LY = TOTALYTD(SUM(Sales[Reevenue]),dateadd('Date'[Date],-1,year))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@sinadvd , looking at screenshot , I doubt either the join with date table is disabled or not there. Please check the join.

Make sure the date table is marked as the date .

The formula seems correct for LY you can also try

YTD LY = TOTALYTD(SUM(Sales[Reevenue]),dateadd('Date'[Date],-1,year))

Thank you so much! the lack of relational connection was the reason!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.