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
crisher
Helper I
Helper I

Time Intelligence DAX not working for YTD PY

https://easierway-my.sharepoint.com/:v:/g/personal/crisher_1path_com/EcfiDHzpFMNEsAzofeM3focBnOENYky...

 

Hey everyone. The above is a video of what I am getting. Effectively, I have tried to use the time intelligence functions, but I am still getting the wrong number.

 

m_BillingTotalCY YTD 2 = TOTALYTD(
SUM(t_STATS_Daily_Billing2[Billing Total]),
t_STATS_Daily_Billing2[Billing Date])
 
m_BillingTotalPY YTD 3 = CALCULATE([m_BillingTotalCY YTD 2],
SAMEPERIODLASTYEAR(t_STATS_Daily_Billing2[Billing Date])
)
 
What am I doing wrong?
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@crisher , Try like

 

m_BillingTotalCY YTD 2 = TOTALYTD(
SUM(t_STATS_Daily_Billing2[Billing Total]),
dateadd(t_STATS_Daily_Billing2[Billing Date],-1,year))

 

You should always use date table for time intelligence

 

m_BillingTotalCY YTD 2 = TOTALYTD(
SUM(t_STATS_Daily_Billing2[Billing Total]),
dateadd(Date[Date],-1,year))

 

 

example

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

refer if needed

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

 

Why Time Intelligence Fails - Power bi 5 Savior Steps for TI: https://youtu.be/OBf0rjpp5Hw

View solution in original post

2 REPLIES 2
crisher
Helper I
Helper I

Thanks, everyone. I will give these a try and report back shortly.

amitchandak
Super User
Super User

@crisher , Try like

 

m_BillingTotalCY YTD 2 = TOTALYTD(
SUM(t_STATS_Daily_Billing2[Billing Total]),
dateadd(t_STATS_Daily_Billing2[Billing Date],-1,year))

 

You should always use date table for time intelligence

 

m_BillingTotalCY YTD 2 = TOTALYTD(
SUM(t_STATS_Daily_Billing2[Billing Total]),
dateadd(Date[Date],-1,year))

 

 

example

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

refer if needed

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

 

Why Time Intelligence Fails - Power bi 5 Savior Steps for TI: https://youtu.be/OBf0rjpp5Hw

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.