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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Divide two variables in a Chart Expression

I have two variables "vGrowth" and "vValue". these values are dispayed in a straight table and the values appear to be correct.I want to divide these two variables and display in a pivot table . I have used the following expression in the chart :

          $(vGrowth) / $(vValue).


However it is Summing both the variables instead of dividing.


Also I have tried using the folowing expression as well :

          DIV(vGrowth,vValue).


This is resulting in all Zero values.


Is this the correct way of dividing two variables?

Please help.


4 Replies
swuehl
MVP
MVP

It depends on how these variables are defined.

Maybe just enclose each dollar sign expansion in (..):

   ( $(vGrowth) ) / ( $(vValue) )

But to tell more, you need to post your exact variable definition (best by posting a small sample QVW)

The Magic of Variables

The Magic of Dollar Expansions

william_allen
Contributor III
Contributor III

This works for me.

$(vGrowth) / $(vValue)

Check the attached QVW that has a pivot table with some generated data and the division of variables as the expression.

Hope this helps.

Not applicable
Author

Thanks Stefan.

I just missed the  (....) .

The expression is working fine now.

swuehl
MVP
MVP

You're welcome.

If your request is resolved, then please close this thread.

Qlik Community Tip: Marking Replies as Correct or Helpful