Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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
Partner Ambassador/MVP
Partner Ambassador/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
Partner Ambassador/MVP
Partner Ambassador/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.