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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
niha
Creator II
Creator II

Doing Calculation in Variables in QlikSense

Hello,

I have a Variable $(vCY2016) which tells visit-counts. ( it has set analysis in it). I have another variable $(vCY2016NHPN).  Now I want to create percentage of Visit. i am not getting correct results.

Now my  $(vCY2016) results is 6 and $(vCY2016NHPN) is 4  and that is coming correct.

for percentage I wrote the following code . it should come 4/10 *100 = 40 %

But this code is coming 7.5 . 

=$(vCY2016)/$(vCY2016NHPN)+$(vCY2016)

 

Please suggest.

Regards,

Niha

1 Solution

Accepted Solutions
Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi there

You are missing brackets so it is evaluating the division part first and then adding the $(vCY2016). Currently your expression is 6/4+6 which means it is 1.5+6 and that is equal to 7.5. Change it to $(vCY2016)/($(vCY2016NHPN)+$(vCY2016)) which will give you 0.4. You can just format it as a percentage.

Regards,

Mauritz

View solution in original post

2 Replies
Mauritz_SA
Partner - Specialist
Partner - Specialist

Hi there

You are missing brackets so it is evaluating the division part first and then adding the $(vCY2016). Currently your expression is 6/4+6 which means it is 1.5+6 and that is equal to 7.5. Change it to $(vCY2016)/($(vCY2016NHPN)+$(vCY2016)) which will give you 0.4. You can just format it as a percentage.

Regards,

Mauritz

niha
Creator II
Creator II
Author

Great! Only one bracket! It worked.

Regards,

Niha