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
alexpanjhc
Specialist
Specialist

Is it possible your v%POScode1 is 0?

Not applicable
Author

That looked promising, however that doesn't give me any value for either.

Not applicable
Author

No, I have values for both variables.

tamilarasu
Champion
Champion

Try this in textbox and check whether you are getting result or not,

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

/

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

I didn't get any results with that.

Not applicable
Author

Hold on... I added the '=' and I did get a result.

Not applicable
Author

Not the number I'm looking for though...

I'm looking for 44%

tamilarasu
Champion
Champion

Seems one (or both) of your expression (s) returns nothing. Check the below expressions separately in text and see what happens.

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

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

sunny_talwar

Try these with the = sign

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

Not applicable
Author

I take my one comment back. The above Range Sum does give me values that match the original. The question still stands on how I can divide them.