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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
mikegrattan
Specialist
Specialist

Expression in variable evaluating as a value instead of an expression

I have expressions in variables, such as the following:

=If((vMeasure) = 'EquivPrice',
(Num(Sum({<ShipDate_DayOfWeek={'Tue'},Week={'$(vWeek)'},ShipYear={'$(vYear)'}>}ExtendedPrice) / Sum({<ShipDate_DayOfWeek={'Tue'},Week={'$(vWeek)'},ShipYear={'$(vYear)'}>}EquivalentUnits),'$##.00'))
,
If((vMeasure) = 'CartonPrice',
(Num(Sum({<ShipDate_DayOfWeek={'Tue'},Week={'$(vWeek)'},ShipYear={'$(vYear)'}>}ExtendedPrice) / Sum({<ShipDate_DayOfWeek={'Tue'},Week={'$(vWeek)'},ShipYear={'$(vYear)'}>}CartonEquiv),'$##.00')),
(Num(Sum({<ShipDate_DayOfWeek={'Tue'},[Week]={'$(vWeek)'},ShipYear={'$(vYear)'}>}$(vMeasure)),'#,##0'))
)
)

As seen in the Variables editor, the one for vTueOrd (expression above) is changed to a value instead of an expression. The one in vMonOrd is almost exactly the same (only ShipDate_DayOfWeek is different), but it behaves correctly.

Please advise.

mikegrattan_0-1737665617474.png

 

Labels (2)
1 Solution

Accepted Solutions
mikegrattan
Specialist
Specialist
Author

I think I figured it out. The "=" sign at the beginning of the expression is forcing it to evaluate. What is confusing is that it's not behaving that way for vMonOrd, only the other variables. I edited all of the other variables, starting with vTueOrd, and removed the "=" sign, and now all variables are behaving correctly.

View solution in original post

3 Replies
mikegrattan
Specialist
Specialist
Author

I think I figured it out. The "=" sign at the beginning of the expression is forcing it to evaluate. What is confusing is that it's not behaving that way for vMonOrd, only the other variables. I edited all of the other variables, starting with vTueOrd, and removed the "=" sign, and now all variables are behaving correctly.

premacharya0903
Contributor II
Contributor II

I see that your vMeasure is evaluated using $ in vTueOrd . Could that be the reason ?

mikegrattan
Specialist
Specialist
Author

It was the "=" sign at the beginning of the expression. I removed it, and now it is behaving correctly. Thanks for your response!