2 Replies Latest reply on Oct 17, 2017 12:57 PM by Brittney Parker

# Combining Weekend Numbers with Friday's Numbers

Hi Guys,

I'm working in Tableau Desktop 10.3, connected to Microsoft SQL Management Studio. For this example I just pulled the data into Excel to make things easier.

What I'm looking for is a way to combine the orders that are booked on Saturday and Sunday to be lumped into the previous Friday's orders booked. I've tried using DATEPART in a calculated field but I just can't seem to figure it out.

Example: I want Friday, October 06, 2017 to show 2,041 (Friday 1508 + Saturday 493 + Sunday 40 = 2041)

and Friday, October 13, 2017 to show 2,055 (Friday 1451 + Saturday 535 + Sunday 69 = 2055)

Is there a way to do this?

Any help would be much appreciated.

Regards,

Brittney

• ###### 1. Re: Combining Weekend Numbers with Friday's Numbers

Hi Brittney. This formula should give you what you are looking for:

DATE(IF DATEPART('weekday',[Ord Booked Date])==1 THEN DATEADD('day',-2,[Ord Booked Date])

ELSEIF DATEPART('weekday',[Ord Booked Date])==7 THEN DATEADD('day',-1,[Ord Booked Date])

ELSE [Ord Booked Date]

END)

Just use that instead of your [Ord Booked Date] field for calculating the totals.

1 of 1 people found this helpful
• ###### 2. Re: Combining Weekend Numbers with Friday's Numbers

Thank you, Brent! That's exactly what I needed.