Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Grouping of Values of a variable

Hi all,

I wanted to categorize and label the value of the cheque amount into group like 0 - 300, 301-600, 600 & over. Is there any ways to go about doing it. I tried to using the expressions below but it doesn't seems to work.

My tables:

Datecheque_amt
01/03/2014200
01/03/2014500
01/03/2014600
02/03/2014300
02/03/2014400
02/03/2014700
03/03/2014300
03/03/2014800
03/03/2014500

Expression 1:

= if(cheque_amt>0 and cheque_amt<=300) as 0-300 Or

if(cheque_amt>301 and cheque_amt<=600) as 301-600 or

if(cheque_amt>601 ) as >600

Expression 2:

=If( cheque_amt>0 and cheque_amt<=300, 0-300

If( cheque_amt>301 and cheque_amt<=600, 301-600,

If( cheque_amt>601, >600)))

1 Solution

Accepted Solutions
its_anandrjs

Hi,

After loading this table take straight table and in

Dimension 1: take date field

Dimension 2: take Bucket field

and in expression write

Expression =sum(cheque_amt)

Hope this helps

Thanks & Regards

View solution in original post

7 Replies
maxgro
MVP
MVP

try with class function

its_anandrjs

Hi,

Create a Bucket like this

Temp:

load * Inline

[

Date, cheque_amt

01/03/2014, 200

01/03/2014, 500

01/03/2014, 600

02/03/2014, 300

02/03/2014, 400

02/03/2014, 700

03/03/2014, 300

03/03/2014, 800

03/03/2014, 500

];

load

*,

if(cheque_amt > 0 and cheque_amt <= 300, '0-300',

if(cheque_amt > 301 and cheque_amt <= 600, '301-600',

if(cheque_amt > 601,'>600'))) as Bucket

Resident Temp;

DROP Table Temp;

Hope this helps

Thanks & Regards

its_anandrjs

Hi,

After loading this table take straight table and in

Dimension 1: take date field

Dimension 2: take Bucket field

and in expression write

Expression =sum(cheque_amt)

Hope this helps

Thanks & Regards

Not applicable
Author

Hi Anand, thanks for your reply. I tried to load inline script that you had given but it appears to have some error while loading. Could it due to the reason that I used the same source data from the table:

 

FROM
C:\.......\data.xls
(biff, embedded labels, table is

[Sheet2$]);

its_anandrjs

Hi,

Yes make changes according to your data location or if you refer my inline code then make changes in your script. Because my table is inline table.

Hope this helps

Thanks & Regards

its_anandrjs

Hi,

Your Expression 2 is similar but make some changes check here

If( cheque_amt>0 and cheque_amt<=300, '0-300',

If( cheque_amt>301 and cheque_amt<=600, '301-600',

If( cheque_amt>601, '>600'))) as Bucket

You can use this script in your load script

Hope this helps

Thanks & Regards

Not applicable
Author

Thanks Anand!! It works now. Really appreciated your help.

Cheers=)