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

How to create a new variable in the table using existing variables?

I have three products and their different attributes in a table "Product". the product types are stored as either 1,2 or 3 in the prdtype variable in the Product table. Now, when I create a bar/pie chart for the counts of this product, it creates three bars, one for each product. The problem is that it lables it as 1, 2 and 3 however, I want it to be labled as small, medium and large. Reading from other posts in the qlikview community, I think by creating a new variable say "prdtype2" which is defined as "Small" where prdtype =1. "Medium" where prdtype = 2 and "Large" where prdtype = 3 and then creating an expression based on the prdtype2 I can get the lables straight. My questions are:

How do i create prdtype2 variable in Product table?

Is this an efficient way?

Is there any way to directly change the labels without creating new variable?

1 Solution

Accepted Solutions
Not applicable
Author

You can creat a inline table with prdtype and prdtype2 and your dimension will be prdtype2 as you said.

If you dont want to change the script and do it directly in the graph, you can use a calculated dimension.

If(prdtype=1, small,

     if(prdtype=2, medium, large)

)

I believe creating the inline is more efficient as it only calculates it when you reload, otherwise everytime you see the graph.

View solution in original post

2 Replies
Not applicable
Author

You can creat a inline table with prdtype and prdtype2 and your dimension will be prdtype2 as you said.

If you dont want to change the script and do it directly in the graph, you can use a calculated dimension.

If(prdtype=1, small,

     if(prdtype=2, medium, large)

)

I believe creating the inline is more efficient as it only calculates it when you reload, otherwise everytime you see the graph.

swuehl
MVP
MVP

I think you could create a new field with your descriptive text like this:

LOAD

prdtype,

pick(prdtype,'Small','Medium','Large') as prdText,

..

from Product;