Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
michak80
Contributor III
Contributor III

Table, Dimension, if

Hello, 

I have a very simple table as below. What I need is to create two columns. First show me only references with code 1, second only references with code 2. 

Can you help me? 

CODE REFERENCE
1 890111991
1 890144345
1 904728933
2 893723672
2 894234873
2 829347234
Labels (1)
1 Solution

Accepted Solutions
fe-c
Contributor III
Contributor III

You are correct. But the logic in the app is the same. Insert a Table and add 2 dimensions (inclusive zero values):

1. dimension with formula

 

=if(CODE=1,REFERENCE,null())

 

2. dimension with formula

 

=if(CODE=2,REFERENCE,null())

 

and rename the columns.

 

You can also work with an variable input. Define a variable like 'vCode' and change the code for the dimension to:

=if(CODE=$(vCode),REFERENCE,null())

Now you can change the value of the variable by buttons or the 'Variable input' from the Qlik Dashboard bundle. The resulting table now shows only REFERENCE by chosen CODE.

View solution in original post

6 Replies
Mark_Little
Luminary
Luminary

Hi.

Are you talking in the front end app or making changes to the script?

michak80
Contributor III
Contributor III
Author

I'm thinking about app. I expect following result. And I need simple table (not Pivot)

 

CODE 1 CODE 2
890111991 -
890144345 -
904728933 -
- 893723672
- 894234873
- 829347234
fe-c
Contributor III
Contributor III

Maybe a possible solution:

[newTab]:
load
    if(CODE=1,REFERENCE,null()) as Code1
    ,if(CODE=2,REFERENCE,null()) as Code2
resident [originalTab];
michak80
Contributor III
Contributor III
Author

thanks but your solution is for script. I need solution in app. 

fe-c
Contributor III
Contributor III

You are correct. But the logic in the app is the same. Insert a Table and add 2 dimensions (inclusive zero values):

1. dimension with formula

 

=if(CODE=1,REFERENCE,null())

 

2. dimension with formula

 

=if(CODE=2,REFERENCE,null())

 

and rename the columns.

 

You can also work with an variable input. Define a variable like 'vCode' and change the code for the dimension to:

=if(CODE=$(vCode),REFERENCE,null())

Now you can change the value of the variable by buttons or the 'Variable input' from the Qlik Dashboard bundle. The resulting table now shows only REFERENCE by chosen CODE.

michak80
Contributor III
Contributor III
Author

thanks!

Now I got it  🙂 works for me