Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparing value in a variable

Hi All,

I'm try to calculate a count of application which have 'vtestonclock' value greater than 30 via the following formula:

count ({$<$(vtestonclock)={">$(= 30)"},[Meeting]={'Full'},

  , [Application ]={'Application -site'},[Current ]={'Approved','Further approved'}>} DISTINCT Application_ref)

It works when i'm putting in the value via dimension 'Taken_OnClock' (instead of 'vtestonclock'). But, doesn't work when i use variable 'vtestonclock'.

Can someone please help me with this (how to correctly put in the variable)?

Any help will be much appreciated.

Kind Regards,

Kshitij

16 Replies
jmvilaplanap
Specialist
Specialist

Hi,

Have you tried to write it between ''?

count ({$<'$(vtestonclock)'={">$(= 30)"},[Meeting]={'Full'},

  , [Application ]={'Application -site'},[Current ]={'Approved','Further approved'}>} DISTINCT Application_ref)

or with equal?

count ({$<$(=vtestonclock)={">$(= 30)"},[Meeting]={'Full'},

  , [Application ]={'Application -site'},[Current ]={'Approved','Further approved'}>} DISTINCT Application_ref)

Not applicable
Author

Hi Jose,

Thanks for your response. I tried both the options but none of them seems to work. Still getting no output.

As i mentioned in my original post, when i use 'Taken_OnClock' it gives me the correct response.

count ({$<Taken_OnClock={">$(= 30)"},[Meeting]={'Full'},

  , [Application ]={'Application -site'},[Current ]={'Approved','Further approved'}>} DISTINCT Application_ref)

Kind Regards,

Kshitij

Kushal_Chawda

what is expression in vtestonclock?

Not applicable
Author

Hi Kushal,

It's a simple if statement which is giving me numbers.in output.

if(len($(vtest))=0,Taken_OnClock,$(vtest))

Regards,

Kshitij

mangalsk
Creator III
Creator III

Define variable vtestonclock='Taken_OnClock', field name in quotes and in expression no need of using quote as follows

count ({$<$(vtestonclock)={">$(= 30)"},[Meeting]={'Full'},

  , [Application ]={'Application -site'},[Current ]={'Approved','Further approved'}>} DISTINCT Application_ref)

Not applicable
Author

Hi Mangal,

Unfortunately, i cannot assign direct value vtestonclock='Taken_OnClock'. I have to use either 'Taken_OnClock' or '$(vtest)' . If the value in $(vtest) is null, then i take 'Taken_OnClock' value (which i'm doing in a if statement). Value obtained from the if statement is being stored in 'vtestonclock'.

if(len($(vtest))=0,Taken_OnClock,$(vtest))


Hope it makes sense.

mangalsk
Creator III
Creator III

It is ok so you can append quotes on this like ='''&if(len($(vtest))=0,Taken_OnClock,$(vtest))&'''  or =if(len($(vtest))=0,'Taken_OnClock','$(vtest)') and rest as said before.

Basically it needs to store as string


Kushal_Chawda

use below expression, your expression should work

=if(len($(vtest))=0,'Taken_OnClock','$(vtest)')


Use single quotes for your field names

Not applicable
Author

Hi Mangal,

It doesn't work. I tried putting single quotes and then double quotes (and vice versa) and then the & sign. But, it doesn't seem to work.

'"&if(len($(vtest))=0,Taken_OnClock_HREC,$(vtest))&"'

Any more help will be much appreciated.