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
Vosina
Frequent Visitor

%Change YoY (problem wth calculation)

Hi everyone, 
in spite there ale quite a lot of videos and descriptions, I have not been able to get to the result I desire with comparing date across years. I have 1 data table with multiple sales in a month and 1 lookup date table. Relation between them is build.
The problem is if I compare 2018 and 2019 data, %change calculates with months in 2018 which have not occured in 2019 yet (makes it -100% these months).
This approach got me farthest but still the TOTALS are wrong.
1) Created ThisYear Measure = ThisYear = SUM([Sales] )
2) Created LastYear Measure = 
CALCULATE(Sales[ThisYear];SAMEPERIODLASTYEAR(Kalendar_Lookup[Datum].[Date]))
3) Created LasYear_cleared Measure= 

IF(ISBLANK(SporeniObjem_Kanaly[SporeniObjemCalc]);BLANK();CALCULATE(Sales[ThisYear];SAMEPERIODLASTYEAR(Kalendar_Lookup[Datum].[Date]))) .... with hope those data which do not have 2019 counterparts will not be calculated. Works in the table view but Sum is still the Same as LastYear 😕
4) Created %Change Measure = 
IF(OR(ISBLANK([LastYear_cleared]);ISBLANK([ThisYear]));BLANK();([ThisYear]/[LastYear_cleared]-1)) ... with the same aim as in Point 3)
The result is that Total shows -51,77% but it should show something like -20,2%. This miscalcuation of course shows in other views and tables for reps

Can you please advise what I am doing wrong. Thank you so much
M.

PercentChangeTable.JPG

2 REPLIES 2
Greg_Deckler
Super User
Super User

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...


@Greg_Deckler wrote:

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


Thank you Greg.  Gave me some time to figure it out but I managed to enter the Dax you suggest. I got somewhere with the ThisYear formula but the LastYear gives me no values, thus %change does not work either. Would you suggest what I am doing wrong?
1. I have got separate Date table (Kalendar_Lookup) with all dates available in the calendar and calucalted columns with Year and Month. 
2. My data table includes Date (1st day of the month) + Value, there are multiple rows with the same date for multiple Sales reps. (normalized)
Another problem I see here is, that I will not recieve %Change 2017/2018 by this formula

Thank you so much

M.
ALL_Years.JPG

2018.JPG2019.JPG

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.

Top Solution Authors