Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Using a variable as a pivot table expression

I have a variable [vTruckCnt] set to equal the expression [SUM(UNUnitRecCnt)/7]. Please see the image below. When my chart expression is set to equal the variable [vTruckCnt], it returns the wrong numbers and basically sums the two individual numbers to give me 352.14

If I change the chart expression to the same expression [vTruckCnt] is set to equal, namely [SUM(UNUnitRecCnt)/7], it returns the proper values, those being 174.57 and 177.57

Any idea why this does not work? I want to be able to use the variable as the expression because I use it, and other expressions, many many times.

Thank you!

error loading image

Tags (3)
1 Solution

Accepted Solutions
Not applicable

Using a variable as a pivot table expression

Thanks for the info on the pictures... I didn't realize they were clickable in the post.

As for the variable, I have tried the following variations and nothing seems to work;

  • =SUM(UNUnitRecCnt)/7
  • =(SUM(UNUnitRecCnt)/7)

Hold on a second... Well you got me looking in the right spot. As it turns out, the = sign must be removed! The correct expression to place in the variable is the following;

  • SUM(UNUnitRecCnt)/7

And now it all works fine.

Thanks NMiller!

4 Replies
Not applicable

Using a variable as a pivot table expression

Not applicable

Using a variable as a pivot table expression

Just trying to get a larger picture. I'll try one more time.

Not applicable

Using a variable as a pivot table expression

Try putting an equals sign before your variable value:

=SUM(UNUnitRecCnt)/7


Then use the variable in your expression the same way you are:

$(vTruckCnt)


I believe there was a recent discussion on the board that talked about how using an equal sign or not can affect the results. I don't remember the exact details, but it is worth a try.

PS your images work fine when clicked on. I'm not sure if you can make them any bigger in the actual post.

Not applicable

Using a variable as a pivot table expression

Thanks for the info on the pictures... I didn't realize they were clickable in the post.

As for the variable, I have tried the following variations and nothing seems to work;

  • =SUM(UNUnitRecCnt)/7
  • =(SUM(UNUnitRecCnt)/7)

Hold on a second... Well you got me looking in the right spot. As it turns out, the = sign must be removed! The correct expression to place in the variable is the following;

  • SUM(UNUnitRecCnt)/7

And now it all works fine.

Thanks NMiller!

Community Browser