Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
shrutipg
Contributor II
Contributor II

Dimension to be set with static values

Test result is single value dimension and psuedo code as follows 

Test Result :  Pseudo Code:
if (Update Score='1' then 'Success', if (Update Score=2 then 'Suspect', if (Update Score='3' then 'Failed')))

How this be created ?

i am getting only Failed as a value with if then else condition even though update score is 1 or 2

 

2 Solutions

Accepted Solutions
GaryGiles
Specialist
Specialist

If Update Score is numeric, you want to use the pick function.

Pick([Update Score], 'Success', 'Suspect', 'Failed') 

View solution in original post

Vegar
MVP
MVP

Yes, pick() was what I was thinking of, not match() . Sorry for missleading you @shrutipg.

 

View solution in original post

7 Replies
Vegar
MVP
MVP

Try adjusting the syntax to this:

if ([Update Score] ='1', 'Success', if ([Update Score] =2, 'Suspect', if ([Update Score] ='3', 'Failed')))

 

Vegar
MVP
MVP

You could even try using Match() pick() for this.

Match ([Update Score], 'Success', 'Suspect', 'Failed') 

Pick([Update Score], 'Success', 'Suspect', 'Failed') 

shrutipg
Contributor II
Contributor II
Author

Hi Vegar, 

 

Thanks , But Update Score returns  numeric value ( 1, 2 , or 3) 

and result should be success, failed, suspect based on numbers returned, match dint work here 

correct me if wrong.

 

 

GaryGiles
Specialist
Specialist

If Update Score is numeric, you want to use the pick function.

Pick([Update Score], 'Success', 'Suspect', 'Failed') 

Vegar
MVP
MVP

Yes, pick() was what I was thinking of, not match() . Sorry for missleading you @shrutipg.

 

Kushal_Chawda

@shrutipg  It is better to create field  using applymap in script instead of using calculated dimension.

Map_Score:
mapping LOAD * inline [
Score, Description
1, Success
2,Suspect
3,Failed ];

Data:
LOAD *,
     applymap('Map_Score', Updated_Score,'NA') as Description
FROM table;

 

Now you can use Description field in Dimension.

shrutipg
Contributor II
Contributor II
Author

Thanks , it has worked 🙂 

but still not able to add this logic to dimension.

It worked when i added the calculation as measure