Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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.

Tags (1)
1 Solution

Accepted Solutions

Re: How to Divide by 2 Variables

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

40 Replies

Re: How to Divide by 2 Variables

How about this:

vCountPOScode1/v%POScode1

Not applicable

Re: How to Divide by 2 Variables

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!

Re: How to Divide by 2 Variables

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

Re: How to Divide by 2 Variables

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

Re: How to Divide by 2 Variables

May be , would you be able to share?

vinay_bangari
Valued Contributor III

Re: How to Divide by 2 Variables

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

Re: How to Divide by 2 Variables

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

Re: How to Divide by 2 Variables

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

Re: How to Divide by 2 Variables

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

Community Browser