Forum Discussion
% difference between years for average sales
Hi mfarali
According to your description, I made a sample and here is my solution. Please follow these steps.
Sample data:
Create five columns to calculate totals.
Totals = SUM('Tabelle1'[values])sum of 2018 = SUMX(FILTER('Tabelle1','Tabelle1'[Year]=2018),'Tabelle1'[values])sum of 2019 = SUMX(FILTER('Tabelle1','Tabelle1'[Year]=2019),'Tabelle1'[values])sum of 2020 = SUMX(FILTER('Tabelle1','Tabelle1'[Year]=2020),'Tabelle1'[values])sum of 2021 = SUMX(FILTER('Tabelle1','Tabelle1'[Year]=2021),'Tabelle1'[values])
Create a calculated column to return the % of each year.
percentage =
IF('Tabelle1'[Year]=2018,'Tabelle1'[sum of 2018]/'Tabelle1'[Totals],
IF('Tabelle1'[Year]=2019,'Tabelle1'[sum of 2019]/'Tabelle1'[Totals],
IF('Tabelle1'[Year]=2020,'Tabelle1'[sum of 2020]/'Tabelle1'[Totals],
IF('Tabelle1'[Year]=2021,'Tabelle1'[sum of 2021]/'Tabelle1'[Totals]))))
Then create a column to return the changes.
change =
IF (
'Tabelle1'[Year] = 2018,
0,
'Tabelle1'[percentage]
- CALCULATE (
MAX ( 'Tabelle1'[percentage] ),
FILTER ( 'Tabelle1', 'Tabelle1'[percentage] < EARLIER ( Tabelle1[percentage] ) )
)
)
Finally, put "Year" and "change" into the line chart, you will get the result as below.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ xiaosun
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
I tried it out but I think the calculations are off. Sharing a sample here
the % change is shown as 4.74% between 2018 to 2019 when its a lot more than that. the % increase would be (16,643,485 - 1,687,711)/1,687,711 = 886.15% increase
not sure how i can attach the pbix file here.
thanks