Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
ndeeleysww
Creator
Creator

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!

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

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)

View solution in original post

7 Replies
rohitk1609
Master
Master

Hi Neil,

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

sunny_talwar
MVP
MVP

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
Creator
Creator
Author

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.

sunny_talwar
MVP
MVP

I think this blogs talk about what we just saw

The Magic of Variables

ndeeleysww
Creator
Creator
Author

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

sunny_talwar
MVP
MVP

No problem at all

ndeeleysww
Creator
Creator
Author

Hi Rohit,

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

Thank you for posting tho!

Neil