Compare Cumulative totals sameperiodlastyear

Symeon

New Member
Joined
Sep 11, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello everybody, I would like to ask a question about the comparison cumulative totals. I have a problem with some of my products which came later in my company. For example, master blocks came in May 2019 and I want to compare cumulative totals from May 2020 to May 2019. My problem is that Dax calculates the cumulative from Jan 2020 rather than May 2020 and I have the wrong result. I would be grateful if someone can help me!

My code Cumulative Yearly Total:=IF([TotalSales]>0;CALCULATE([TotalSales];FILTER(ALL(dDate);dDate[Date]<=MAX(dDate[Date]));VALUES(dDate[Year])))

YTDLY:=IF(HASONEVALUE(dDate[Month]);SUMX(VALUES(dDate[Month]);IF([TotalSales]>0;CALCULATE([Cumulative Yearly Total];SAMEPERIODLASTYEAR(dDate[Date])))))

comparisoncumulative:=IF(AND(HASONEVALUE(dDate[Year]);([YTDLY]>0));[Cumulative Yearly Total])

ChangeYTD:=IF([YTDLY]>0;[comparisoncumulative]-[YTDLY])
Thanks in advance!
 

Attachments

  • Cumulative Total.JPG
    Cumulative Total.JPG
    115 KB · Views: 20

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
comparison cumulative totals!
 

Attachments

  • Comparison Cumulative Totals.jpg
    Comparison Cumulative Totals.jpg
    206.1 KB · Views: 21
Upvote 0

Forum statistics

Threads
1,215,553
Messages
6,125,483
Members
449,233
Latest member
Deardevil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top