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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
khadeer
Specialist
Specialist

Variable value?

Hi Everyone,

I have one variable which represents interest, Suppose it giving value for month selections as follows,

Apr- 30, May-40, June-50, July-10

My requirement is when i am selected may it will show total of Apr+May= 70, similarly if i selected june - 30+40+50= 120,

Here i want to add variable value,

I used this expression,

sum({$<Month={"<=$(=Month)"}>}$(Variable)

sum({$<Month={"<=$(=Month)"}>}$(Values)..... For this i am getting correct value. But when i am using same expression for variable, i am getting current selection.

i.e if selecte may, its showing May month value= 40, but i want to show 70

14 Replies
khadeer
Specialist
Specialist
Author

Hi,

Its not working.

My variable is having following expression

=(num(sum({$<Cus_ID={66010,66011,66012},Month={$(=min(Month))},RBUSA={'XXX'},Quarter=>}POB))

+

(RangeSum(sum({<Cus_ID={66010,66011,66012},Month={$(=max(Month))},RBUSA={'XXX'},Quarter=>}Amount))

+

(num(sum({$<Cus_ID={66010,66011,66012,},Month={$(=max(Month))},RBUSA={'XXX'},Quarter=>}POB)))))/2

Its giving correct values for every month, quarter n year selection. let my values(variable) are

Apr=100

May=200

June=150

July=300

If i selected Apr,May then 100+200=300 ... this also i am getting for respective selections.

But if i selected may i want to show Apr+May=300 instead of selecting both.

similarly If i selected june 100+200+300

july= 100+200+150+300

Hope i am clear in what i am saying. Its very urgent....

Thanx in advance

sivarajs
Specialist II
Specialist II

can you check how your variable storing all the values for month

I guess on basis of your month selection the variable showing value.It dont holds all the values

khadeer
Specialist
Specialist
Author

Its holding the values as per selections,

My varible expression working fine for my requirement.

rlp
Creator
Creator

I think that the problem is the double Set analysis constraint on month:

- Firstly, the outer constraint is Month={"<=$(=Month)"}

-Secondly, the inner constriants are included into the variable Month={$(=min(Month))}

I tested this situation with fake variables and QlikView badly behaves.

I suggest to invert inner and outer i.e. use Month={$(=min( {$<Month={"<=$(=Month)"}>}  Month))}

In order to do it properly, you should parametrize your variable i.e. insert $1 where you want to insert the parameter and call the variable with the syntax $(variable(parameter)

In your case, you should write

Month={$(=min( {$<Month={$1}>}  Month))}

and call with

sum($(Variable("<=$(=Month)"))

Regards.

khadeer
Specialist
Specialist
Author

Thank you for your reply,

I will try.....