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
ElektroCED
Regular Visitor

Problems with Time Comparison

Hello everyone, I'm having a problem with time comparisons using the following formulas (indicated by a forum user):


YTDmeasure= TOTALYTD(SUM(Table[Total Sales]), Table[Dates])

PYTDmeasure= CALCULATE(YTDmeasure, PARALLELPERIOD(Table[Dates], -12, Months))

Comparison= DIVIDE(YTDmeasure-PYTDmeasure, PYTDmeasure)

 

(Obviously I insert the values ​​of my table and I also added a comparison between this year and two years ago)

 

In general they work very well, but in some cases (like the one below) they report incorrect values:

 

ElektroCED_0-1634551335721.png

CY = Current Year; PY = Previous Year; 2PY = comparison with two years ago; YTD = Year to Date

 

The following values, for example, are correct (I report them in order to have a further feedback):

 

ElektroCED_1-1634551575301.png

 

N.b: all comparisons work up to today's date.


Thanks a lot to those who want to try to solve the problem and have a good day.

 

Gabriele

1 REPLY 1
amitchandak
Super User
Super User

@ElektroCED ,

Please use date table, Which is very important for time intelligence. Join date of you table with date of date table. Date in table should not have time in it.

 

YTDmeasure= TOTALYTD(SUM(view_PBI_ORD_CLI[IMPORTO_PAG_V1]), 'Date'[Dates])

PYTDmeasure= TOTALYTD(SUM(view_PBI_ORD_CLI[IMPORTO_PAG_V1]),dateadd( 'Date'[Dates],-1, year))

 

refer

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

 

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

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.