Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Best way to find % of Items Priced in a certain Group

Okay here I go.  I have many items with many different prices.  I want to first group those items priced into increments of 50 Cents.  For example

Item     Price    

A          .75    

B          .95

C          1.25

D          1.49

I want QlikView to give me this, i set the paraments that Price Group A is anything price between 50 cents and $1, and Price Group B is anything priced between $1.01 and $1.50

Item     Price     Price Group

A          .75          A

B          .95          A

C          1.25        B

D          1.49        B

Many Thanks

1 Solution

Accepted Solutions
Not applicable
Author

Hi James,

It can be achieved in three ways.

1st Way:

TABLE1:

LOAD Item,

           Price,

           if((Price>=.5 and Price<=1.0),'A-Class',if(Price>=1.01 and Price <=1.50,'B-Class',if(Price>1.50,'Others'))) as Class

INLINE

[

Item,Price

A,.75

B,.95

C,1.25

D,1.49

];

2nd Way:

TABLE2:

LOAD * INLINE

[

Item1,Price1

A,.75

B,.95

C,1.25

D,1.49

];

TABLE3:

LOAD * INLINE

[

Class1,Low,High

A-Class,0.5,1.0

B-Class,1.01,1.5

];

IntervalMatch (Price1) Load Low,High resident TABLE3;

3rd Way

Just load the data either from excel or using inline load. Create a Straight Table with dimensions as Item and Price

In the expressions just use this "=class(Price,0.5,'Price')" and check 'No Totals' in the same Expressions Tab.

Regards,

Srikar

View solution in original post

6 Replies
whiteline
Master II
Master II

I want QlikView to give me this

In script or in view (Chart) ?

Not applicable
Author

A script

Not applicable
Author

Hi James,

Just check the attached Qlikview file.

Regards,

Sri

Not applicable
Author

THANKS, any way you can just post the script, I am using the personal edition version and am unable to open the one you sent.

Again, THANKS

Not applicable
Author

Hi James,

It can be achieved in three ways.

1st Way:

TABLE1:

LOAD Item,

           Price,

           if((Price>=.5 and Price<=1.0),'A-Class',if(Price>=1.01 and Price <=1.50,'B-Class',if(Price>1.50,'Others'))) as Class

INLINE

[

Item,Price

A,.75

B,.95

C,1.25

D,1.49

];

2nd Way:

TABLE2:

LOAD * INLINE

[

Item1,Price1

A,.75

B,.95

C,1.25

D,1.49

];

TABLE3:

LOAD * INLINE

[

Class1,Low,High

A-Class,0.5,1.0

B-Class,1.01,1.5

];

IntervalMatch (Price1) Load Low,High resident TABLE3;

3rd Way

Just load the data either from excel or using inline load. Create a Straight Table with dimensions as Item and Price

In the expressions just use this "=class(Price,0.5,'Price')" and check 'No Totals' in the same Expressions Tab.

Regards,

Srikar

Not applicable
Author

THANKS