Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
lukas_sokol
Contributor II
Contributor II

using variable in expresion

Hi,

I have the following problem

I have variable vUserCompanyCode with store  company  codes (loaded from excel) for specifed user

I have sample expresion below ( working)

sum( if( WildMatch(CompanyCode, 10,20,25,30) , NetSales))

but when i use variable ( the result is emty), variable have the same value (10,20,25,30)

sum( if( WildMatch(CompanyCode,$(vUserCompanyCode)) , NetSales))

Regards

Łukasz

15 Replies
lukas_sokol
Contributor II
Contributor II
Author

vUserCompanyCode is dynamic variable, so I can't assing values directly

if  I have more than one Company code in variable  thats not working.

lukas_sokol
Contributor II
Contributor II
Author

If in the set analysis I add condition

and  WildMatch(CompanyCode, 10,20, 30)    --this is ok

if i use variable $(vUserCompanyCode)

when variable $(vUserCompanyCode) = 10

and  WildMatch(CompanyCode, $(vUserCompanyCode))  --this is ok

when variable $(vUserCompanyCode) = 10,20,30

and  WildMatch(CompanyCode, $(vUserCompanyCode)) --this is NOT ok

Not applicable

Hi,

This should do the trick:

sum({$<  $(='CompanyCode= {' & $(vUserCompanyCode)  & '}') >}NetSales)

Best regards,

Daniel

tamilarasu
Champion
Champion

No. The vUserComnayCode variable looks fine. You need to change the expression as sum( {<CompanyCode={$(=vUserCompanyCode)}>} NetSales).. Since you are using formula in your vUserCompanyCode. If the above one not work, then try with '$(vUserCompanyCode)'.. Let me know..

tamilarasu
Champion
Champion

You can also try like

Sum({<CompanyCode={"$(=$(vUserCompanyCode))"}>} NetSales)

lukas_sokol
Contributor II
Contributor II
Author

Than's evryone for help

The below expression works fine

sum({<CompanyCode={$(=vUserCompanyCode)}>} FakturabeloppBase)

but one more thing, definition of vUserCompanyCode must start with "="

Regards

Łukasz