Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

How to create a table containing variable values and compute results

Dear Qlikview Experts.

I would like to do something like this;

Step 1

SET Var1 = Col1;

SET Var2 = Col2;

Let us say for example the result of Var1 = 1000 and  Var 2 = 2000.

Then Create a table like this:

Step 2

NumberCol    VarCol

10                    Var1

20                    Var2

30                    Var1

40                      Var2

Then I would like to do some pivot table calculation based on this table like this:

Step 3

DIM              EXPRESSION

NumberCol    NumberCol+VarCol

I want to see the following result.

DIM  EXPRESSION

10          1010

20          2020

30          1030

40          2040


I am attaching a file here. As you can see I can get the pivot1 derived from Table3 in the script working. But Pivot2 derived from Table4 is not working.

Can someone help me achieve this?

Thank you very much in advance.

Regards,

KS

3 Replies
Gysbert_Wassenaar
Not applicable

Re: How to create a table containing variable values and compute results

Use this expression: =NumberCol + Pick(match(VarCol,'Col1','Col2'),Col1,Col2)


talk is cheap, supply exceeds demand
Not applicable

Re: How to create a table containing variable values and compute results

Fantastic. That works. Thank you very much Gysbert. I have attached the solution.

rgvavihs
Not applicable

Re: How to create a table containing variable values and compute results

try this

let Var1 =1000;

LET Var2 =2000;

T1:

load Number+VarCol as New,

Number;

LOAD *

Inline [

Number,VarCol

10    ,     $(Var1)

20     ,    $(Var2)

30      ,   $(Var1)

40       , $(Var2)

]