Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have data with many years, but I only want to see the max year and max year - 1, max year - 2, max year - 3.
Can I make this in my script or on another place?
Thanks
I would do it in the load script using a suitable WHERE when loading the data.
u can do in both the ways,
in ur script.
where yeardatefield>=(max(yeardatefield) -3)
You can restrict it within the script by creating a variable vMaxYear
Data:
LOAD fieldNames,
Year
FROM yourSource;
MaxYear:
LOAD Max(Year) as maxYear
Resident Data;
LET vMaxYear = Peek('maxYear');
DataTable:
NoConcatenate
LOAD *
Resident Data
Where Year >= ($(vMaxYear) - 3);
DROP TABLES Data, MaxYear;
HTH
Best,
Sunny
Thanks all!
But I now I don't want this, but in my data I have the years 2026,2088 can I exclude them?
You can do this to exclude anything after the year 2026
Where Year < 2026;
or you can exclude anything from next year forward:
Where Year <= Year(Today());
HTH
Best,
Sunny
Oke and this : Where Year < 2026; must I copy past in my script?
LOAD Number,
Year
FROM
Source
Or must i copy past it behind Year?
Ya i would paste it after the FROM/Resident statement in the table from which you want to exclude Year 2026 and beyond.
LOAD Number,
Year
FROM Source
Where Year < 2026;