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: 
Not applicable

How to Divide by 2 Variables

I have two variables.... They are both counts of certain criteria. I want to be able to write an expression to divide them. When I write it.... I get a blank line. I know my two variables are working correctly. I put them both in a KPI and the numbers populate.

I wrote my expression like so.... $(vCountPOScode1) / $(v%POScode1)

I'm not sure why this isn't working. Please advise.

40 Replies
sunny_talwar

Can you try adding '=' before the RangeSum for both your expressions

Not applicable
Author

Yes, Those both give me the values I've had all along. They are returning numbers to me. I just need them to divide by each other -  which is where I don't receive a value.

Not applicable
Author

I added an = to each variable and tried the following in my gauge....

$(=vCountPOScode0/=v%POScode0)

$(vCountPOScode0/v%POScode0)

tamilarasu
Champion
Champion

Fine. Change your variable like below,

v%POScode1:

( count({<[Position Code]={12,42}>}SID) + count({<[Sales Manager$.Position Code]={04,41}>}[Sales Manager$.SID]) + count({<[Service Advisor$.Position Code]={13,14,27,40}>}[Service Advisor$.SID]) + count({<[Service Manager$.Position Code]={08,09,17,32,33,35}>}[Service Manager$.SID]) )

vCountPOScode1:

( Count({$<[LEVEL 0 COMPLETION]={"Y"}, [Position Code]={12,42}>}SID) + Count({$<[Sales Manager$.LEVEL 0 COMPLETION]={"Y"}, [Sales Manager$.Position Code]={04,41}>}[Sales Manager$.SID]) + Count({$<[Service Advisor$.LEVEL 0 COMPLETION]={"Y"}, [Service Advisor$.Position Code]={13,14,27,40}>}[Service Advisor$.SID]) + Count({$<[Service Manager$.LEVEL 0 COMPLETION]={"Y"}, [Service Manager$.Position Code]={08,09,17,32,33,35}>}[Service Manager$.SID]) )

And try this expression in textbox

$(vCountPOScode1) / $(v%POScode1)

Not applicable
Author

The expressions for the variables work... but the / by variables expression still returns no value. I don't understand what's missing. I have two numbers, which can be divided to give me a value (%) but why won't Qlik Sense recognize it?

Not applicable
Author

Don't give up on me guys. I really need help to figure this out

sunny_talwar

Just out of curiosity, have you tried this

vCountPOScode1/v%POScode1


with and without ('=')


=RangeSum(

Count({<[Position Code]={12,42}>}SID),

Count({<[Sales Manager$.Position Code]={04,41}>}[Sales Manager$.SID]),

Count({<[Service Advisor$.Position Code]={13,14,27,40}>}[Service Advisor$.SID]),

Count({<[Service Manager$.Position Code]={08,09,17,32,33,35}>}[Service Manager$.SID]))


=RangeSum(

Count({$<[LEVEL 0 COMPLETION]={"Y"}, [Position Code]={12,42}>}SID),

Count({$<[Sales Manager$.LEVEL 0 COMPLETION]={"Y"}, [Sales Manager$.Position Code]={04,41}>}[Sales Manager$.SID]),

Count({$<[Service Advisor$.LEVEL 0 COMPLETION]={"Y"}, [Service Advisor$.Position Code]={13,14,27,40}>}[Service Advisor$.SID]),

Count({$<[Service Manager$.LEVEL 0 COMPLETION]={"Y"}, [Service Manager$.Position Code]={08,09,17,32,33,35}>}[Service Manager$.SID]))

Anonymous
Not applicable
Author

phaneendra.kunche‌ can you please help on this.

Not applicable
Author

Yes. I have edited the variables to the stated about and when I put 'vCountPOScode1/v%POScode1' as the expression in the gauge, it doesn't like the field names so I change it to '$(vCountPOScode1/v%POScode1)' and it doesn't give me any numbers.

Please advise if I am not seeing something correctly. I really appreciate you not giving up on me!

sunny_talwar

Do you see anything in the KPI object when you use variation of your expression in them?