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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
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

15 Replies
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...

Not applicable
Author

Hi Sunny,

I have data like below:

Id        Id1        Name

1          1          aaa

2          2          bbb

3          3          ccc

4          1          ddd

5          2          eee

6          1          fff

7          2          ggg

8          3          hhh

9          4          iii

10        5          jjj

I am passing Id value while loading.

Say for example

If i pass Id as 1 , then need to display names in straight table like

aaa

bbb

ccc

If i pass Id as 2 , then need to display names like

bbb

ccc

If i pass Id as 3 , then need to display names like

ccc

If i pass Id as 4 , then need to display names like

ddd

eee

If i pass Id as 5 , then need to display names like

eee

If i pass Id as 6 , then need to display names like

fff

ggg

hhh

iii

jjj

and it continues.

Please help!

Thanks

Sheela

sunny_talwar

Is this for a dimension? If it is, you might need Aggr() function

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

Peter_Cammaert
Partner - Champion III
Partner - Champion III

What exactly is vid? A variable or a field? And what does it contain when loading your id-id1-Name table?

Not applicable
Author

Hi Stefan,

Finally solved

Thank you so much:)

As u suggested, declared variable in variable overview and same variable used in Expression.

n Thank you all for your Help:)

Regards

Sheela

swuehl
MVP
MVP

You're welcome.

Please always keep in mind that context is very important (and I think the context was unclear in description of your post).

So please add a description of the use case (value set during LOAD, expected result shown in a chart with dimensions X,Y,Z etc.) to every single post, or link to the other posts you described the scenario.

And also consider creating a small, reloadable sample QVW. It makes it much easier to understand your model and data and to work on a solution. Follow the links Sunny posted above to learn how to create and upload a sample QVW.

Regards,

Stefan