Same day last year sales.

sadath

Active Member
Joined
Oct 10, 2004
Messages
267
Office Version
  1. 365
Platform
  1. Windows
Hi

I have DAX to calculate same day sales last year which is working fine

SameDayLY:=calculate(sum(SALES[SALESLY]),dateadd(SALES[DATE],+1,day))

after 29th Feb the formula should be

SameDayLY2:=calculate(sum(SALES[SALESLY]),dateadd(SALES[DATE],+2,day))

when i combine the two formula it is not working

ie SameDayLy3:=if(SALES[DATE]>=date(2016,3,1),[SameDayLY2],[SameDayLY])

or any alternate formula

Thanks
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Leap years are complex. It depends on the business rules. It sounds like your business rules say "Same day, same month but prior year". This implies that 29th Feb is compared against nothing. And next year there will be 1 day last year not compared againt the new year.

So so maybe you need something like this

=calculate(sum(sales[sales ty]),dateadd(calendar[date],-12,month))

also it looks like you don't have a calendar table. This is mandatory for time intelligence. Read about it here Power Pivot Calendar Tables -
 
Upvote 0
Hi
Thank you very much,

if(max(SALES[DATE])..... works fine,
 
Upvote 0

Forum statistics

Threads
1,224,154
Messages
6,176,731
Members
452,740
Latest member
MrCY

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