3 Replies Latest reply on Feb 13, 2019 3:29 PM by Ainsley O'Sullivan

# Week-To-Date Sales

I would like to calculate Week-to-Date Sales and I use the following formula

IF [Day] <= TODAY()

AND DATEDIFF('week',[Day],TODAY())= 0 THEN [Sales] END

However according to my data I've got Sales for 22nd and 23th of January but I need the sum of sales for the period of 16-22 of January.

How can I change the formula to get sum of sales for the correct period?

• ###### 1. Re: Week-To-Date Sales

I've sorted out this issue and updated the formula:

IF DATETRUNC('week', [Day]-1)+1 <= TODAY()

AND DATEDIFF('week',DATETRUNC('week', [Day]-1)+1, TODAY())= 0 THEN [Sales] END

• ###### 2. Re: Week-To-Date Sales

Hello All

In case it helps, I developed a way to have the week to date for all the weeks, not only the current one.

The formula is:

if DATEPART('weekday', [date]) <= DATEPART('weekday', today()) then [Sales] END

This formula provides the week-to-date for all the weeks, so in order to compare just need to drop Sales into columns and filter previous 2 weeks, if you just want to create this week vs previous.

I hope it helps

P.S.: I developed the same but for non-us as weeks starts on Monday, if someone needs it please just send me a message

• ###### 3. Re: Week-To-Date Sales

Do you have formula for when the week starts on a Monday?

Thanks,

Ainsley