Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following Set expression within one of the dimensions of a straight table:
Sum({$<$(vSetPreviousNMonth(0))>} [# Departures Performed])
where vSetPreviousNMonth has the following definition:
PeriodID = {$(=Max(PeriodID) – $1)}, Year = , Quarter = , Month = , Period =
leaving $1 to insert parameters and output something else, the problem is that this does not work and the script syntax highlighting
displays it as an error. Is this expression written properly or is there a specific reason this does not work?
PS: I'm relatively new to Set analysis and Qlikview overall
HI Leonardo,
May be this will work for you:
Sum({<$(vSetPreviousNMonth)>} [# Departures Performed])
=Sum({<$(vData)>}Value)(this work For Me)
Thanks,
Arvind Patil
I tried with an = at the beginning but it did not work.
Hi Leonardo,
sometimes the script editor tells you there's an error in set analysis when there isn't. Try your expression vSetPreviousNMonth with various values written in place of the $1 parameter as a way to test. To my eyes your expression looks okay.
good luck
Andrew
Hi,
May be like this
Expression:
Sum({<$(vSetPreviousNMonth)>} [# Departures Performed]) or
Sum({<$(#vSetPreviousNMonth)>} [# Departures Performed])
vSetPreviousNMonth :
PeriodID = {"$(=Max(PeriodID))"}, Year = , Quarter = , Month = , Period =
When you say it doesn't work, does it not give you any solution or is it just showing a null?? Would you be able to share a sample to take a look at this?
I see no added value in using the variable with parameter as opposed to using it directly in the expression. The various $ expansions and the moments that they are evaluated make it very tricky. Directly in the expression:
Sum({$<PeriodID = {"$(=Max(PeriodID )-0)"},Year=,Quarter=,Month=,Period=>} [# Departures Performed])
Edited:Bold parts
Sorry guys this was an error on my part, the Set expression was working but the relationship between the Master Calendar and the Fact Table within the data model was non-existent, therefore the calculations returned 0 at every turn, although I do appreciate the answers provided, I had to look at the data model for a good 30m to figure this out (The answer was to create a primary key between both tables from common fields in both tables), thanks for the help non the less.