Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
lucasdavis500
Creator III
Creator III

Why is Qlikview not evaluating my variable in a chart correctly

I have some functions that I'm using more than once in chart/table creation in qlikview:

I have a few concerns. Whenever I try to store my function:

=(SUM({<[Not_my_Dummy] = {'1'}, some_dummy= {'1'}>} [0-7_dummy]) + SUM([ACDV_0-7_dummy]))/(COUNT({<[Not_my_Dummy] = {'1'}, some_dummy= {'1'}>} [0-7_dummy]) + COUNT([ACDV_0-7_dummy]))

into a variable it causes some issues...

First, this is how my chart looks with my Dimension set to Month:

Var_before.png

BUT, if I click on ANY of these given months, the value suddenly changes to what "may or may not be" the correct number:

Var_after.png

Why is Qlikview doing this? surely people can't be reusing functions over and over in each chart/table they create, only to change them all one-by-one if needed....

Also, I have the SAME function stored in a chart/table with the SAME dimension, and qlikview returns different numbers.... has anyone else had an issue with this?

1 Solution

Accepted Solutions
MK9885
Master II
Master II

Do not use = when storing the expression into variable.

(SUM({<[Not_my_Dummy] = {'1'}, some_dummy= {'1'}>} [0-7_dummy]) + SUM([ACDV_0-7_dummy]))/(COUNT({<[Not_my_Dummy] = {'1'}, some_dummy= {'1'}>} [0-7_dummy]) + COUNT([ACDV_0-7_dummy]))

View solution in original post

4 Replies
robert_mika
Master III
Master III

How did you define your variable?

MK9885
Master II
Master II

Do not use = when storing the expression into variable.

(SUM({<[Not_my_Dummy] = {'1'}, some_dummy= {'1'}>} [0-7_dummy]) + SUM([ACDV_0-7_dummy]))/(COUNT({<[Not_my_Dummy] = {'1'}, some_dummy= {'1'}>} [0-7_dummy]) + COUNT([ACDV_0-7_dummy]))

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

I suspect that your variable definition begins with the equal sign, right? If that's the case, it means that your expression is being calculated once, not in the context of your chart dimensions. For that reason, you are getting identical values across the chart. For the same reason, the result looks better if you make a selection - after your selection, the formula in the variable gets evaluated again, and it shows a "better" result now.

Long story short - remove the equal sign in front of your formula in the variable definition and see what happens.

cheers,

Oleg Troyansky

Learn advanced QlikView and Qlik Sense techniques in my book QlikView Your Business

vinieme12
Champion III
Champion III

Have a read

The Magic of Variables

The Little Equals Sign

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.