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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Diving a Variable using Expression

Hi All,

I have a variable as 'vVol' with expression as -

sum({$<$(vFlag)= {'1'}>}vol1) + sum({$<$(vFlag)={'1'}>}vol2)

When I try to divide above variable with some expression, I am not getting the expected value for example -

($(vVol)

/(sum({$<$(vFlagP)= {'1'}>}vol1) + sum({$<$(vFlagP)={'1'}>}vol2)))-1

Can anyone pls assist.

Regards,

MK

9 Replies
sunilkumarqv
Specialist II
Specialist II

Create a variable like below

vVol=(sum({$<$(vFlag)= {'1'}>}vol1) + sum({$<$(vFlag)={'1'}>}vol2))


can you share sample App so we can work on that

jonathandienst
Partner - Champion III
Partner - Champion III

vVol has two terms, so you need to wrap it in an extra pair of brackets, otherwise only the 2nd term is being divided:

(($(vVol)) / (sum({$<$(vFlagP) = {'1'}>}vol1) + sum({$<$(vFlagP) = {'1'}>} vol2)))-1

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Kushal_Chawda

Are you getting wrong values or nothing?

Anonymous
Not applicable
Author

I am getting null values.

Kushal_Chawda

may be try below in variable

rangesum(sum({$<$(vFlag)= {'1'}>}vol1) )+ rangesum(sum({$<$(vFlag)={'1'}>}vol2))

qlikmsg4u
Specialist
Specialist

(sum({$<$(vFlag)= {'1'}>}vol1) + sum({$<$(vFlag)={'1'}>}vol2))/((sum({$<$(vFlagP)= {'1'}>}vol1) + sum({$<$(vFlagP)={'1'}>}vol2)))-1)

try the above one, if that works fine

do like this

($(vVol))/((sum({$<$(vFlagP)= {'1'}>}vol1) + sum({$<$(vFlagP)={'1'}>}vol2)))-1)

sasiparupudi1
Master III
Master III

you have the same expression in the variable and in the denominator??

put this in a text object sum({$<$(vFlagP)= {'1'}>}vol1) + sum({$<$(vFlagP)={'1'}>}vol2))) and see if returns a valid value

Anonymous
Not applicable
Author

not working...

sasiparupudi1
Master III
Master III

you can not use the expression like this

sum({$<$(vFlagP)= {'1'}>}vol1)

try changing it as follows

sum({$<YourDimension={1}>}Vol1)+sum({$<YourDimension={1}>}Vol2)