Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
In the script, i have a table with the fields :
Date, CD_SOCIETY,CD_ENTITY,CD_PRODUT, VOLUME
I want to add a field VOLUME_N_1 wich is the value of VOLUME for last year using the field VOLUME.
How can i do this in the script please ?
Thanks
TRY THIS
LOAD *,
IF(YEAR=Max(YEAR), VOLUME) AS VOLUME_N_1;
LOAD
Date,
CD_SOCIETY,
CD_ENTITY,
CD_PRODUT,
VOLUME,
year(Date(Date)) AS YEAR
FROM TABLE;
Do you mean that records in this year have an additional field that shows the total volume for last year for all products etc ?
Jonathan
IF(Max(year(Date(Date,'YYYY'))) >0, VOLUME) AS VOLUME_N_1
TRY THIS
LOAD *,
IF(YEAR=Max(YEAR), VOLUME) AS VOLUME_N_1;
LOAD
Date,
CD_SOCIETY,
CD_ENTITY,
CD_PRODUT,
VOLUME,
year(Date(Date)) AS YEAR
FROM TABLE;