Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Can i use a variable in a dimension?

Can i use a variable in a dimension so i do not have to write each dimension value for different dimensions in a chart?

1 Solution

Accepted Solutions
ychaitanya
Creator III
Creator III

You could use the CROSS TABLE Load in the script and convert them into meaningful data , then you could easily perform the required calculation at the Expression Level.

I have got sample data to illustrate. This may help.

Example.JPG

View solution in original post

7 Replies
olivierrobin
Specialist III
Specialist III

hello

in as dimension you enter a field name, not each value of the field

you can use a variable in the form $(variable name) and in that case, the content of the varaible is used as field name

ashishbhuyekar
Contributor III
Contributor III

Variable is meant to store only one ouput value. Hence I don't think you will be able to derive multiple dimension using single variable.

You can define variables for each dimension i.e. for you calculate dimension and get a control over dimension.

ychaitanya
Creator III
Creator III

Yes we have concept like that which we're using now.


Created random 5 inline fields, passed as selections for fields to be displayed in pivot table.

used those selections via variables in our dimensions.

EX:

$(=ONLY({1<%Dim_Name = {'$(vVariable)'}>} %Dim_FieldName))
Thanks

CY

MarcoWedel

please post a sample of what you currently are trying to implement.

Anonymous
Not applicable
Author

Hi All ,

Thanks for your input , probably my question was wrong..

Below is the problem statement and i am looking for a solution.

I have different columns like P1,P2,P3...P20 i.e 20 different columns. And the values in it are 1 and 0 . i want to count the number of 1's against the Primary Key.

Current i am counting it in an expression of the chart - count( distinct if(P2=1),PID);  but i have to write it 20 different times for each values , i wanted to know if there is way to display it in a chart by not repeating the different values each time .

PS- I am relatively new to Qlikview and sorry if i have confused you more with my question.

ychaitanya
Creator III
Creator III

You could use the CROSS TABLE Load in the script and convert them into meaningful data , then you could easily perform the required calculation at the Expression Level.

I have got sample data to illustrate. This may help.

Example.JPG

Anonymous
Not applicable
Author

Thank you Chaitanya , it should work with my requirement