Forum Discussion
motyagi
Helper I
8 years agoYear Over Year Percentage Calculation not working
Hi There, I am trying to do a Year over Year calculation in power BI for the following data Period Total Production Variance Financial Year Identifier 12/31/2014 70 Prior Period 2 ...
- 8 years ago
Hi motyagi,
Based on my test, we can get the values as you want the following steps.
1. Enter the data as you shared and create the measure as below:
VarianceLastYear = Calculate(SUM('Inventory Summary Data'[Total Production Variance]) ,SAMEPERIODLASTYEAR('Inventory Summary Data'[Period]))VarianceLast2Year = TOTALYTD(SUM('Inventory Summary Data'[Total Production Variance]),DATEADD('Inventory Summary Data'[Period],-2,YEAR))YoYVariance = var P =SELECTEDVALUE('Inventory Summary Data'[Financial Year Identifier]) return IF(P = "Current Period",[SumVariance]/[VarianceLastYear]-1)YoYVariance2 = var P =SELECTEDVALUE('Inventory Summary Data'[Financial Year Identifier]) return IF(P = "Current Period",[SumVariance]/[VarianceLast2Year]-1)
2. Then we can get the result as below.For more details, please check the pbix as attached.
Regards,
Frank
v-frfei-msft
Community Support
8 years agoHi motyagi,
Based on my test, we can get the values as you want the following steps.
1. Enter the data as you shared and create the measure as below:
VarianceLastYear = Calculate(SUM('Inventory Summary Data'[Total Production Variance]) ,SAMEPERIODLASTYEAR('Inventory Summary Data'[Period]))VarianceLast2Year = TOTALYTD(SUM('Inventory Summary Data'[Total Production Variance]),DATEADD('Inventory Summary Data'[Period],-2,YEAR))YoYVariance = var
P =SELECTEDVALUE('Inventory Summary Data'[Financial Year Identifier])
return
IF(P = "Current Period",[SumVariance]/[VarianceLastYear]-1)YoYVariance2 = var
P =SELECTEDVALUE('Inventory Summary Data'[Financial Year Identifier])
return
IF(P = "Current Period",[SumVariance]/[VarianceLast2Year]-1)
2. Then we can get the result as below.
For more details, please check the pbix as attached.
Regards,
Frank
motyagi
Helper I
8 years agoThanks ! this works great :)