Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculation condition based on a variable

Hi, I need to have a calculation condition based on a variable on a chart.

e.g. Value < $(vLimit)

vLimit is a variable that has a value. But the chart doesn't seem to take care of this condition. Can you please help?

Thanks,

Ram    

1 Solution

Accepted Solutions
Jason_Michaelides
Luminary Alumni
Luminary Alumni

Try setting this as your expression:

Sum({<Value={"<$(vLimit)"}>} Value)

This should sum together all rows where Value < vLimit. The total may of course be greater than vLimit as the comparison is done on a row level.  Is this what you wanted?

Hope this helps,

Jason

View solution in original post

5 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

Do you mean you don't want the chart to calculate at all or do you mean an individual expression?

Not applicable
Author

Hi Jason,

I have a simple bar chat with 1 dimension and 1 fact(expression).The expression is sum(Value).

But I want the chart to take into consideration only those records that satisfy this condition

    value < $(vLimit)

vLimit is a variable associated with an input box.

if i have rows like

      dim1      Value

      CON     1000

      FX        2000

      GA       2500

if vLimit is 1500, I want to show only CON in the chart.

Thanks

Ram

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Try setting this as your expression:

Sum({<Value={"<$(vLimit)"}>} Value)

This should sum together all rows where Value < vLimit. The total may of course be greater than vLimit as the comparison is done on a row level.  Is this what you wanted?

Hope this helps,

Jason

Not applicable
Author

Thanks Jason. That answers my question and it is working fine.

Just want to make sure what is the utility of this Calculation condition then?

Jason_Michaelides
Luminary Alumni
Luminary Alumni

There may be circumstances where you do not want a chart to calculate at all. for example, it might be possible to return millions and millions of rows which may endanger your production servers at affect all users. You may want to tell the chart to only calculate if it is going to return a safe number of rows or perform the calculations over a safe size dataset.