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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Krish2459_58
Creator II
Creator II

if clause error

Hi,

 

We are trying to write a if caluse to deal with dynamic chart lable, but getting error as below.

lable expression:


=if(GetSelectedCount([Lease Status])>0 ,[Lease Status], 'Active+Inactive')
if(GetSelectedCount([Leased / Owned])>0 ,[Leased / Owned], 'Leased / Owned')
if(GetSelectedCount([Leased / Owned])=0 and GetSelectedCount([Lease Status])=0,'Leased / Owned test')

Krish2459_58_0-1727680338159.png

 

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

@Krish2459_58  You are missing "," after completion of If condition. Check the if statement syntax on Qlik help site. 

Remember that if condition is evaluated only once and it evaluates row by row. Hence, you need to construct your if in such a way that same condition is not evaluated again.

 

 

if(GetSelectedCount([Lease Status])>0 ,[Lease Status],
if(GetSelectedCount([Lease Status])=0 ,'Active+Inactive',
if(GetSelectedCount([Leased / Owned])>0 ,[Leased / Owned],
if(GetSelectedCount([Leased / Owned])=0 and GetSelectedCount([Lease Status])=0,'Leased / Owned test','Leased / Owned')
)))

 

View solution in original post

1 Reply
Kushal_Chawda

@Krish2459_58  You are missing "," after completion of If condition. Check the if statement syntax on Qlik help site. 

Remember that if condition is evaluated only once and it evaluates row by row. Hence, you need to construct your if in such a way that same condition is not evaluated again.

 

 

if(GetSelectedCount([Lease Status])>0 ,[Lease Status],
if(GetSelectedCount([Lease Status])=0 ,'Active+Inactive',
if(GetSelectedCount([Leased / Owned])>0 ,[Leased / Owned],
if(GetSelectedCount([Leased / Owned])=0 and GetSelectedCount([Lease Status])=0,'Leased / Owned test','Leased / Owned')
)))