Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I just wanted you to see what I have come up with this script bit. As you can see from my notes, I want to load the max timestamp in my data then compare it to now timestamp and load the data according to this vDate IF statement I did.
Max_Date:
Load timestamp(max(DayStart([date timestamp])), 'DD/MM/YYYY hh:mm:ss.ffffff') as MaxDate //with this i want to load the max date timestamp in my dataset with 00:00:00.00000 timestamp
from [$(vPathQVD)Sales.qvd] (qvd);
let vNow = Now(); // with this i want to get today's timestamp
Let vCorrectDate=If(MaxDate<vNow, date(floor(MaxDate-1)), date(floor(MaxDate))); // with this i want to compare timestamp MaxDate with Now() timestamp and if maxDate<vNow holds, then return me the previous of the MaxDate floored, else floored MaxDate
sales:
LOAD
"ID product",
"amount sold",
"availability"
"date timestamp"
FROM [$(vPathQVD)Sales.qvd]
(qvd)
where Date(Floor("date timestamp"),'DD/MM/YYYY') <='$(vDate)'; //so as to load data according to vCorrectDate
Is my thinking correct? Do you see any mistakes? Should I add something else?
Thank you in advance.
Hi @ioannagr
Fyip: Comparing number format is very effective & flexible when compare to date / timestamp format..