Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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.

1 Solution

Accepted Solutions
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]))

View solution in original post

40 Replies
sunny_talwar

How about this:

vCountPOScode1/v%POScode1

Not applicable
Author

Nope. That didn't work. Any other ideas or thoughts? I really need to solve this for work today. Any help is huge. I appreciate it!

sunny_talwar

How about this:

$(=vCountPOScode1)/$(=v%POScode1)

and also have you used = sign before your variable definition? Sometimes adding/removing it helps in QlikView. My guess is that it will help in Qlik Sense as well

Not applicable
Author

That didn't work either. I tried with and without the = sign. Would it help at all seeing may variable expressions?

sunny_talwar

May be , would you be able to share?

Anonymous
Not applicable
Author

Lauren, By seeing the chart i can say that this is from Qlik Sense. you would get better answers if it is posted directly in qlik sense

Not applicable
Author

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])

Not applicable
Author

Opps! Good Catch. I moved it to 'New to Qlik Sense"

sunny_talwar

How about try these as your variables:

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]))