Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
NEW webinar Dec. 7th: 2023 Outlook, A Pivotal Year for Data Integration SIGN ME UP!
cancel
Showing results for 
Search instead for 
Did you mean: 
dreweezy
Partner - Creator II
Partner - Creator II

creating buckets based on values

Hi all,

New to Qlik and have loaded in my data. I am trying to create 2 buckets based on a value of the column. If the value is a negative number then I want to create a bucket "Neg" and "Pos" if the value is positive. Can someone kindly guide me on where I can create this bucket and how the syntax should look.

Thanks.

1 Solution

Accepted Solutions
m_perreault
Creator III
Creator III

You can use the class function to create buckets in your script or in a chart.

https://help.qlik.com/en-US/sense/November2018/Subsystems/Hub/Content/Sense_Hub/Scripting/Conditiona...

 

If you're bucket is as simple as Positive vs Negative you can create a flag in your script such as

Load,

ID,

Value,

If(Value>0,'Positive',If(Value<0,'Negative')) as Bucket

From xx;

 

View solution in original post

3 Replies
m_perreault
Creator III
Creator III

You can use the class function to create buckets in your script or in a chart.

https://help.qlik.com/en-US/sense/November2018/Subsystems/Hub/Content/Sense_Hub/Scripting/Conditiona...

 

If you're bucket is as simple as Positive vs Negative you can create a flag in your script such as

Load,

ID,

Value,

If(Value>0,'Positive',If(Value<0,'Negative')) as Bucket

From xx;

 

pradosh_thakur
Master II
Master II

pick(match(value,fabs(value))+1,'Neg','Pos') as Bucket
Learning never stops.
dreweezy
Partner - Creator II
Partner - Creator II
Author

I was able to create an additional column in the load script to designate whether that row/record is a Positive or Negative value. My next question - I want to create a KPI to show the count of records 'BY' a specific dimension. Let say I want to count the # of positive values by Country. How does the syntax work? When I was using Oracle BI syntax would be similar to Count(Country by Product). Thank you.