Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
alexbjorlig
Creator
Creator

Declare variable inside set analysis

Hi Qlik Community.

Is it possible to declare a variable inside a set analysis?

marked in red what I hope to achieve:

local_variable= 2

sum({<

Calendar_Date={">=$(=weekstart(Date(Max(Calendar_Date)+(7*local_variable))))<=$(=Date(weekstart(Date(Max(Calendar_Date)+(7*local_variable)))+6))"}

,_Employee_FlagTerminated-={1}

,TimeForecastVersion_Name={"Commit"}

,Calendar_WeekOfYear=

,Calendar_YearInt=

>}M_ForecastHours)

Please note that I am aware of the variable declaration in variable overview, but I'm not interested in this solution if possible.

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

What do you want to achieve with this? Could you explain? Maybe we could come with suggestions by other approaches?

You can parameterize a variable - turning it into something similar to a function? Would that be helpful?

View solution in original post

3 Replies
petter
Partner - Champion III
Partner - Champion III

No this is not possible. Variables exist on a global scope in QlikView and they are declared via menus and dialogs or in your load script. You could also declare them via the COM-api and Macros...

petter
Partner - Champion III
Partner - Champion III

What do you want to achieve with this? Could you explain? Maybe we could come with suggestions by other approaches?

You can parameterize a variable - turning it into something similar to a function? Would that be helpful?

alexbjorlig
Creator
Creator
Author

Hi Petter. 

Thanks for the help - and good to know it's not possible. I guess it would be for rapid replication of expressions, say:

if(sum({<

,_Employee_FlagTerminated-={variable}

>}M_ForecastHours)

/

sum({<

,_Employee_FlagTerminated-={variable}

>}M_UsedHours)>0,

sum({<

,_Employee_FlagTerminated-={variable}

>}M_ForecastHours)

/

sum({<

,_Employee_FlagTerminated-={variable}

>}M_UsedHours))