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: 
robintw
Contributor III
Contributor III

Variable with multple values

Hi, 

 

I want to create multiple dimensions like something below:

=Sum({<BusinessUnit ={200,300,400}>} Sales)

But I also want to do this for Cost of sales etc. Therefore I thought it is a good idea to create variables so in the case that a variable changes I don't have to adjust all dimension. For example:

=Sum({<BusinessUnit ={'$(=Vsales_BU)'}>} Sales)

To do this, I need to create a variable with multiple values (i.e. 200, 300, 400). 

I tried several thing in the variables creation window, however I don't manage to get this solved since the variable doesn't accept commas and other things I tried didn't work as well. 

 

Does anyone know how I can create a variable with values 200, 300, 400 and refer to it in a dimension?

Labels (4)
1 Solution

Accepted Solutions
robintw
Contributor III
Contributor III
Author

Hi all, 

 

I tried ChatGPT and it is amazing. I gave me the solution. I first had to use SET for creating the variable. After that, I could easily refer to it in the dimension. 

View solution in original post

3 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

"since the variable doesn't accept commas"

Is it possible you are confusing the variable name with the variable definition? The name may not accept commas, but the definition should.

-Rob

robintw
Contributor III
Contributor III
Author

Hi Rob, 

 

Thank you for your response. What I meant was the definition but I was not very clear in my question. I tried to do the following in the definition:

'200, 300, 400'

And in the dimension I used:

=Sum({<BusinessUnit ={'$(=Vsales_BU)'}>} Sales)

However this will not create the expected result. And I think this is because it sees value of the variable not as three seperate values but as one. Do you have the solution for this?

robintw
Contributor III
Contributor III
Author

Hi all, 

 

I tried ChatGPT and it is amazing. I gave me the solution. I first had to use SET for creating the variable. After that, I could easily refer to it in the dimension.