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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Teppo_Ojala
Former Employee
Former Employee

Question about variables

Hi,

Does anyone know if this is possible or not in QV.

Can I call a variable with parameter-information?

One example: I have 5 KPI's and I have an expression, which has for example little bit set analysis and some other logic. In the set analysis I tell which KPI I am looking for, for example KPI={'5'}

I can of course write 5 varibles, one per each  KPI - but my question is: can I write only one variable and then use KPI as paramter when calling the variable.

This example is not a real one. I just have thought that this would be very useful in some cases.

Thanks!!

7 Replies
Not applicable

Hi

I use this trick very often in data analysis.

1) Create a variable KPI (Setting > Variable Overview)
2) Create an input box with the variable KPI 

     Then go to Constraints panel > Predifined Values

     Check Listed Value 

      Example :     check   KPI1,KPI2, KPI3, KPI4, KPI5   

3)  Create a chart using generic formula  : 

        Sum(  $(KPI) )

Hope it helps you

JJ

Teppo_Ojala
Former Employee
Former Employee
Author

Thanks, this is a useful tip too, but I am sorry this doesn't help me in this case. Or atleast I think so

My idea is (again for example) to have these KPI's listed same time in the sheet. I think you can't have 5 charts next to each other using one variable and showing 5 different KPI's with this inout field logic? If variables would be like finctions, this would be possible to do. Just by calling a variable like this =$(v_kpi_value(KPI1))

But this is nor possbile and I don't find out a work around for this. What do you think, would this be a good enhance request for new QV versions? I think I could find out use cases for this.

Not applicable

Toa,

Variable with parameter is possible. I could able to make it work with simple if statemen but not bale to do it with set analysis.

Check out out this application. hope this helps you.

- Sridhar

mike_garcia
Specialist
Specialist

Yes, the solution provided by Sridhar is the way to do it... If you require more information about it, look for 'Dollar-Sign Expansion with Parameters' in the QlikView help.

Mike.

Miguel García
Qlik Expert, Author and Trainer
Teppo_Ojala
Former Employee
Former Employee
Author

Great,

Exactly the solution that I am looking for. Thanks for quick help!!

I managed to get Set analysis working with formula: 

sum({<KPI_trans = {'$1'}>} Amt)

Teppo

Teppo_Ojala
Former Employee
Former Employee
Author

One more thing. Any ideas why the textbox with two variable calls doesn't work. I tried to call the variable twice in one text box, but I can't get two sums as a result to this object. You can find this problem from attached qvw.

This is a minor problem, but I am just curious..

Thanks again,

Teppo

Not applicable

Teppo,

I managed to take the second set to next line, it started displaying the value. But no idea why the same is not working with single line .

Have a look at the application.

- Sridhar