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: 
Not applicable

Parameters to variable with alternate states

Hi, I'm trying to create a variable that I can use for computations either with or without alternate states.

So far I have come up with the following (vSales):

If(

  $1=Null(),

  Sum(Sales),

  Sum({$1} Sales )

The thing is that it seems to work when I supply the state names. However, it messes up the charts where I have a drill-down group but where I don't use alternate states. When I click on the chart where I don't supply alternate state names to the variable I don't drill down to the next level but rather get to see everything, also stuff that does not belong to that group.

I know that drill-down groups don't work with alternate states but I had thought the variable expression I have should not care about that when I supply $(vSales()) to the chart because it does not contain a reference to an alternate state in the set analysis. The charts where I write $(vSales(State1)) seem OK although I have not done detailed validation because I cannot get past this issue.

I could create variables for each state but I find that to defeat the purpose of having all computation details tucked neatly into variables. The code would be identical except for the set analysis.

Any ideas?

Unfortunately, I cannot send my QlikView file because it contains sensitive data.

0 Replies