Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need my script to only pull in data from the current month and the previous 2 months, how do i do that?
May be like this:
TempTable:
LOAD Date(MonthStart(Today(), -2)) as Date
AutoGenerate Today() - MonthStart(Today(), -2);
FactTable:
LOAD AllFields,
DateField
FROM....
Where Exists(Date, DateField);
Thank sunny but that just gave me 01/06/2016
You can try combination of sorting, peek and rangesum.
LOAD
Month,
Value,
RangeSum(Value, Peek(Value, -1), Peek(Value, -2)) as 3M_Cumulative
From Source
Order By Month;
maybe use a where clause like:
where datefield >=addmonths(monthstart(today()),-2)
Just needed to be this - Where Date>=(MonthStart(Today(), -2)
Thanks
Good to use Where Exists if you are looking to do an optimized QVD load
Ok, it's a fairly small load so should be ok but if it begins to slow I'll look to add it
Sounds good