Discussion Board for collaboration on QlikView Scripting.
I am trying to apply a filter like this:
I have the NumYearMonth field wich has numeric values eg: 1,10,15,etc, etc
I only need to retrieve one value and that is the penultimate, next to last, before to last one, secont last, however you want to call it.
The field should always contain a sequencial numeric value, so for instance if the highest number is 30, I only want the 29 value to be loaded.
The numbers may change reload after reload so I need something dinamic.
I was thinking something like
WHERE NumYearMonth = Max(NumYearMonth) -1
I have the below script;
Where NumYearMonth = Max(NumYearMonth) -1 and
([AuditPhase]='DDQ' or [AuditPhase]='OSI' or [AuditPhase]='EDD');
But QlikView doesn't like that.
Any ideas how can I accomplish this?
Use the same table,
Max(NumYearMonth) -1 as max_minus_1
group by KEY
so you compute the max value minus 1 grouped by key fields, then you have to load first table
and do left join with the second one "Second"
It have to work.
Hope it helps
can you please provide a test data.
Hello, use the idea of Alexandros17.
Once you create the auxiliary table, use the PEEK function to return the most value and use it in their condition.
MAX(NumYearMonth) -1 as max_minus_1
WHERE NumYearMonth = PEEK('max_minus_1') and