Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

ndeeleysww
Contributor

Measure not dividing by variable amount

Hi there,

I'm trying to calculate percentage values in a table.

I've created a variable called (AC - DWS) which calculates the total number of records for a measure. This calculates and I can output the results to a text box:

p1.jpg

I'm using this variable to divide by the total records for a particular dimension., If I manually add the result as a number, the division works:

P2.jpg

If I use the result of the variable, it doesn't:

P3.jpg

Any idea why? It also doesn't work if I add the calculation used to get the variable value:

Count({1<[Ops Function]={'Drinking Water'}, DataSource={'Alarms'}, [Alarm Status]={3}, Date={'>=$(=Date($(vTodaysDate)))'}>} AlarmCount)

Any help gratefully received!

Tags (2)
1 Solution

Accepted Solutions

Re: Measure not dividing by variable amount

Did you try adding a '=' before your Count function in the variable?

=Count({1<[Ops Function]={'Drinking Water'}, DataSource={'Alarms'}, [Alarm Status]={3}, Date={'>=$(=Date($(vTodaysDate)))'}>} AlarmCount)

7 Replies
rohitk1609
Valued Contributor II

Re: Measure not dividing by variable amount

Hi Neil,

Can you please tell me or show me the expression how you are creating the variable ?

Re: Measure not dividing by variable amount

Did you try adding a '=' before your Count function in the variable?

=Count({1<[Ops Function]={'Drinking Water'}, DataSource={'Alarms'}, [Alarm Status]={3}, Date={'>=$(=Date($(vTodaysDate)))'}>} AlarmCount)

ndeeleysww
Contributor

Re: Measure not dividing by variable amount

Hi Sunny,

Thank you - that worked. The odd thing is that it had already been working up till we had 3.0 installed, so perhaps the syntax has been tightened on variable creation.

Highlighted

Re: Measure not dividing by variable amount

I think this blogs talk about what we just saw

The Magic of Variables

ndeeleysww
Contributor

Re: Measure not dividing by variable amount

I'll read that one thoroughly! Thank you for all your help (again!)

Re: Measure not dividing by variable amount

No problem at all

ndeeleysww
Contributor

Re: Measure not dividing by variable amount

Hi Rohit,

All solved thank you - Sunny (posts below) showed me the way....

Thank you for posting tho!

Neil