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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
cm
Contributor II
Contributor II

Setting Range Min and Max to 0-100

Hi folks,

Obviously new to QlikSense and to coding generally. I'm trying to normalize the results of a value set on a 0-100 scale. Here's the expression:

=(((count(distinct [Incident Number]))+Sum([Drug Weight (lb)]))/Sum([Total]))

Results range from .00001 to 50.

Any way to set the value range to Rangemax = 100 and Rangemin = 0  ?

How do you do that within the expression?

1 Solution

Accepted Solutions
rwunderlich
MVP
MVP

I'm assuming you are calculating this over a Dimension, for example "Drug".  If so, then you need to compute the max Drug value and use that as a divisor. Use max() and aggr() to find the largest value. 

=(((count(distinct [Incident Number]))+Sum([Drug Weight (lb)]))/Sum([Total]))
/  Max( Aggr( (((count(distinct [Incident Number]))+Sum([Drug Weight (lb)]))/Sum([Total])), Drug))

And then multiply the whole thing by 100 unless you want it as a percent. 

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

View solution in original post

2 Replies
rwunderlich
MVP
MVP

I'm assuming you are calculating this over a Dimension, for example "Drug".  If so, then you need to compute the max Drug value and use that as a divisor. Use max() and aggr() to find the largest value. 

=(((count(distinct [Incident Number]))+Sum([Drug Weight (lb)]))/Sum([Total]))
/  Max( Aggr( (((count(distinct [Incident Number]))+Sum([Drug Weight (lb)]))/Sum([Total])), Drug))

And then multiply the whole thing by 100 unless you want it as a percent. 

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

cm
Contributor II
Contributor II
Author

You're the man.