Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
julioarriaga
Creator II
Creator II

Pick(Match()) is not working properly in assigning a number format

Hi, everyone,

I am trying to assign an Pick_match expression in the format paremeters in the num function. This expression is assigned to a variable called vFormat and it gives a format of M (millions), k, (thousands) or normal. The variable vDivision assigns a value of 1,1000 or 1000000 depending on the case. 

The problems is this expression works correctly like this:

NUM(Sum(Measure)/$(vDivision),PICK(MATCH($(vDivision),1000000,1000,1),'#,###.## M','#,###.## k',''))

But not with this format:

NUM(Sum(Measure)/$(vDivision),'$(=$(vFormat))')

NOR $(vFormat), '$(vFormat)',$(=$(vFormat)),'$(=$(vFormat))'

I attach also a qvf file with the example

Thanks in advance for your invaluable support.

P.S. The variables must be defined on a qvs file/script. 

ImageComparison.PNG

 

Labels (2)
2 Replies
msteedle
Luminary Alumni
Luminary Alumni

When you set vFormat in the script, it is evaluating vDivision immediately:

SET vFormat =PICK(MATCH($(vDivision),1000000,1000,1),'#,###.## M','#,###.## k','');

As a result, if you look at the value of vFormat in the Variable overview, you can see it has a hardcoded value rather than a reference to vDivision:

PICK(MATCH(1000,1000000,1000,1),'#,###.## M','#,###.## k','')
julioarriaga
Creator II
Creator II
Author

Thank you for your answer. Is there a way of loading a variable inside another variable from a script/qvs file and avoiding the hardcoding of the value?