Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
AB108
Contributor III
Contributor III

Inconsistencies in Variables

Hi,

I am creating a variables that I am using in my Charts.

These look like--

v_sum1 :Sum({<Dim1=' '....>}( A1+A2)*$( v_variable2))

They are working fine when I pull them in chart expressions stand alone but giving inconsistent results if I try to add them in an expression--$(v_sum1)+$(v_sum2) etc

In one expression, they dint give result if I used them as ---- $(v_sum1)-($(v_sum2)+$(v_sum3))-($(v_sum4)+$(v_sum5))

but later worked when ---$(v_sum1)-$(v_sum2)-$(v_sum3)-$(v_sum4)-$(v_sum5)

Appreciate any help here.

 

Labels (2)
1 Reply
marcus_sommer

Chaining and nesting of variables are possible but it could become quite tricky because the syntax by the creation and the calling are depending on their specific context. Therefore you need to be very careful by developing such approaches.

In your case the issue might be caused from any in the variables included comments or not related to the variables from the kind of operator between the variables. If you used + or - it means the entire calculation will be NULL if any of the operands didn't returned a valid numeric value. Therefore it's most often better to include an error-handling like: alt($(var), MyNumericDefaultValue) or using a range-function like rangesum() which handled all non-numeric values as zero.