Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
nkosinde13
Creator
Creator

Evaluating a variable on straight table

Hi All

I have a variable that I created and I'm using it on a straight table as part of an expression, but it's not returning any value.

  IF(SaleType1 = 'Total SBIB Sales Penetration',$(vTotal)

How do I evaluate a variable in an if statement?  Please assist.

Thank you

9 Replies
neelamsaroha157
Specialist II
Specialist II

May be you can use $1 in your variable expression and then pass the value of SalesType1 -

For Example -

vTotal = Sum(Sales) then you can replace it by Sum({<$1>}Sales) or Sum({<SaleType1 = {$1}>}Sales)


And then the expression (If using second expression)- $(vTotal('Total SBIB Sales Penetration'))

manoj217
Creator III
Creator III

IF(SaleType1 = 'Total SBIB Sales Penetration',$(vTotal)

you missed the ) at last and check your sales type1 value it is matched or not with your existing data

nkosinde13
Creator
Creator
Author

Hi Neelam. Thank you but I'm not understanding the example you gave me. Are you saying I should create a variable for Total SBIB Sales Penetration then call the variable in the expression? I'm being confused by $1  part in your comment. Can you please elaborate further. Thanks

nkosinde13
Creator
Creator
Author

Hi Manoj, It's still not working. Thanks

shiveshsingh
Master
Master

Try this

  IF(SaleType1 = 'Total SBIB Sales Penetration',"$(=vTotal)")


or


  IF(SaleType1 = 'Total SBIB Sales Penetration','$(=vTotal)')

manoj217
Creator III
Creator III

can you share the variable definition

neelamsaroha157
Specialist II
Specialist II

Check this resource for parameters in set analysis -

$-Sign Expansions in QlikView

So the $1 is like defining the parameters where you can supply the values later while using the variable.

nkosinde13
Creator
Creator
Author

Thank you very much Neelam, this is really helpful.

nkosinde13
Creator
Creator
Author

Thank you guys, but nothing is working. So in the meantime I created same variable twice, one with an = mark and the other without as I'm using them on different objects.