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

% Difference between Last Year WTD and This Year WTD for Online and Store Sales

Hi, 

I am trying to resolve the issue with averages.
I have a dataset like this one below:

slavisha84_0-1618288114276.png

So I have a fiscal week from 1 to 52. Within each week I Have Online and Store sales. I calculated variances by subtracting 2020 from 2021 Revenue which is fine. However, when I try to do the % difference per Fiscal week I am not getting the correct results overall. 
I do get the correct result per channel but if I select all I am I am getting wrong results. 
The reason is that Power BI calculates WTDYOY% for each line separately. So since I have FiscalWeek for Online and Fiscal Week For Store, the WTDYOY% will be calculated separately for each of these. And I get the correct results. But when I select all PowerBI try to add or average results for Online WTDYOY% and Store WTDYOY% which is not correct. 
I need to be able to present Fiscal week overall, Online, and CSR separately and correct. 

How do I fix this?

Here is the folder where i have sample of data:
https://1drv.ms/u/s!AhhZq1add5YwjYIvuASi76lCL3R1eA?e=sZQshq

slavisha84_2-1618289799240.png

 

 



1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@slavisha84 

Rather then putting your results in a new table you should calculate them with measures.

Revenue Amount = SUM ( RevenueByDate[Revenue] )
2020 Revenue = CALCULATE ( [Revenue Amount], FiscalCalendar[FiscalYear] = 2020 )
2021 Revenue = CALCULATE ( [Revenue Amount], FiscalCalendar[FiscalYear] = 2021 )
Variance = [2021 Revenue] - [2020 Revenue]
WTDYOY% = DIVIDE ( [Variance], [2020 Revenue] ) 

That way the calculations will work at whatever level you are expanded to and with whatever slicers you apply.

jdbuchanan71_0-1618292032094.png

I have attached my updated version of your file for you to look at.

View solution in original post

1 REPLY 1
jdbuchanan71
Super User
Super User

@slavisha84 

Rather then putting your results in a new table you should calculate them with measures.

Revenue Amount = SUM ( RevenueByDate[Revenue] )
2020 Revenue = CALCULATE ( [Revenue Amount], FiscalCalendar[FiscalYear] = 2020 )
2021 Revenue = CALCULATE ( [Revenue Amount], FiscalCalendar[FiscalYear] = 2021 )
Variance = [2021 Revenue] - [2020 Revenue]
WTDYOY% = DIVIDE ( [Variance], [2020 Revenue] ) 

That way the calculations will work at whatever level you are expanded to and with whatever slicers you apply.

jdbuchanan71_0-1618292032094.png

I have attached my updated version of your file for you to look at.

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.