Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variables with parameters

Hi,

I want to create a table with a variable with parameter. For example, i have the dimension year, and a variable that calculate the sales

of each year vSalesperYear($(variable1)), the thing is that the value of variable1 depends on de dimension year.

Imagine this is a qlikview table with dimension year and expresion $(variable1)

      year   variable1  

     2014      1

     2015      2

I want to create a table with dimension year and expression vSalesPerYear($(variable1)).

Can anyone help me??

Thanks,

10 Replies
Not applicable
Author

What are you trying to accomplish with these variables? You might be able to accomplish your goal without using variables. Can you explain what your end goal is?

Not applicable
Author

i use variables only to use the expression i many graphs.

without using variables would be like this

sum({<idDate={"expresion that calculate the id"}>}sales)

but the expression that calculate the id depends on the dimension year, and the table i want to create have year

as a dimension, so i want that the expression that calculate the id, changes with the diferrentes values of year in my table

Not applicable
Author

Is there any chance you could share your qvw? It would help in giving you a specific answer.

Not applicable
Author

sry, i cant.  Confidential information of my company.

Not applicable
Author

What is the "expression that calculates the id"?

Not applicable
Author

is any expresion for example min(iddate), the important things is that the expression changes with the diferrent values of the dimension

like this

year     min(iddate)    sum({<idDate={"min(iddate"}>}sales)

2010          1             sum({<idDate={"1"}>}sales) i want the result of this exprresion

2011          3             sum({<idDate={"3"}>}sales)

Not applicable
Author

Are you saying you want to dynamically change which expression will calculate the value of a particular variable?

Not applicable
Author

So you want this:

sum({<idDate = {min(iddate from a certain year)>}Sales)

?

Not applicable
Author

correct, but i seems that Set Analysis will only get evaluated once for your objects, it does not get evaluated for every single row.