Forum Discussion

Vosina's avatar
Vosina
Frequent Visitor
6 years ago

%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.

2 Replies