Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jmialoundama
Specialist
Specialist

Get last friday

Hello, 

Hello, I have several dates and I wish to recover only the last Friday. Here I wish to recover only the 16/11/2018.

Capture.JPG

I wrote the following script:

LOAD "RCT - Code",
"Web - Date expedition",
sum("Web - quantité expdiée") as "Qté expédiée vendredi (uniquement)"
FROM [lib://QVD_Rec (omnium_dec1)/DWH\F_EXPORT_CDE_WEB.QVD](qvd)
Where Date("Web - Date expedition")= Date(Weekstart(Today())-3)
Group by "RCT - Code",
"Web - Date expedition";

The function Date(Weekstart(Today())-3)   returns well the last Friday which is the 16/11/2018

 

However when I load my data there is no date of 16/11/2018 coming out of my column

 

1 Solution

Accepted Solutions
jmialoundama
Specialist
Specialist
Author

thanks for your reply ! 

I found where the problem came from.

The problem came from the format of the sate so I had to transform it in the following way:

Where Date(Floor(TimeStamp#("Date expedition",'DD/MM/YYYY hh:mm:ss')),'DD/MM/YYYY')

And it works! 🙂

View solution in original post

3 Replies
shiveshsingh
Master
Master

Make sure your date format for LHS and RHS match. Please define the Date format using Date# interpreter and Date func

 Date("Web - Date expedition")= Date(Weekstart(Today())-3)

jmialoundama
Specialist
Specialist
Author

thanks for your reply ! 

I found where the problem came from.

The problem came from the format of the sate so I had to transform it in the following way:

Where Date(Floor(TimeStamp#("Date expedition",'DD/MM/YYYY hh:mm:ss')),'DD/MM/YYYY')

And it works! 🙂

Vinay39
Contributor
Contributor

but how to get the Friday date  automatically when i want daily

eg: for Monday we have took -3, for Tuesday it will change right

then how can we get automatically