Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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
Highlighted
MVP
MVP

Re: Divide two variables in a Chart Expression

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
New Contributor III

Re: Divide two variables in a Chart Expression

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

Re: Divide two variables in a Chart Expression

Thanks Stefan.

I just missed the  (....) .

The expression is working fine now.

MVP
MVP

Re: Divide two variables in a Chart Expression

You're welcome.

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

Qlik Community Tip: Marking Replies as Correct or Helpful