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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding integer number to expression

Hi all,

Need to check condition like

If (Id = ( If(Id=1,vid) + 1 ), 'true','false')

For example : If(Id=1,vid) gives value 1, then add 1 to it which is 2

So given expression works like 

If(Id=2,'true','false')

But it is not working. Is there any other solution or need to correct syntax?

Please Help!

Thanks

Sheela

1 Solution

Accepted Solutions
swuehl
MVP
MVP

What is the context of your chart expression? A dimension Id?

I assume this has something to do with your other post, where you pass a value for Id and you need a static retrieval vid:

Create a variable vVid in variable overview:

=Only({1<Id = {$(vIdSetDuringLOAD)}>} vid) //Check if Only is appropriate or if you need another aggregation

Check that this returns the proper result, e.g. in a text box.

In your table chart, you can then use

=If(Id = Rangesum(vVid,1), Name)

But as with your other post, a real working sample QVW and expected results would make help much easier...

View solution in original post

15 Replies
sumit_ranjan_pa
Former Employee
Former Employee

Can you please share more details what exactly you want to do? As from the details of your question i can see you want to have the calculation to return false always. There will not  be a regular case of true at all.

Not applicable
Author

Hi Sumit,

I want check condition exactly like

If (Id = ( If(Id=1,vid) + 1 ), Name)

Inner if condition value + 1 and  need to compare with Outer Id , if it is true ,display name else not.

Like

If (Id = ( If(Id=1,vid) + 1 ), Name)

If (Id = ( 1 + 1 ), Name)

If (Id =2 , Name)

Thanks

Sheela


sunny_talwar

Where are you doing this? How can a single row have Id = 1 and Id = 2 at the same time? Can you provide a sample to look at?

Not applicable
Author

Hi sunny,

I am writing this in ' Expression' mode of Straight table.

Sorry, it is like

If (Id = ( If(Id1=1,vid) + 1 ), Name)

Thanks

Sheela

Peter_Cammaert
Partner - Champion III
Partner - Champion III

The + operator doesn't really like adding to NULL. So whenever your inner IF evaluates to false, it will cause NULL (your implicit else value) to be added to 1, which results in NULL again... And logical expressions cannot use the = operator to compare to NULL.

Use Rangesum() to avoid a calculation from returning a NULL value. Like in

IF (Id = (RangeSum(IF(Id1 = 1, vid), 1)), Name)


The RangeSum expression will always return either vid+1 or 1.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

And make sure that for every evaluation of this expression, both Id and Id1 referrals return exactly one value. Or you will again be comparing to NULL.

Not applicable
Author

Hi Peter,

Thanks for your reply!

IF (Id = (RangeSum(IF(Id1 = 1, vid), 1)), Name)


This expression meets the requirement, but it is not returning anything.Please Help.


Thanks

Sheela

sunny_talwar

Can you share few rows of data?