Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Total Amount of Specific Item Price Range

Hi all

I have a table like this

Item CodePriceQty.Total Amount
A11001100
B12403120
C35702140
D631251125
E231104440
F122002400
G361201120
H66753225
I8450150
J171001100
TOTAL1820

Now, I want codes for Total Amount of specific Price Range. Like this:

Price RangeTotal Amount
X < 50120
50 <= X < 75190
75 <= X < 100225
100 <= X < 125760
125 <= X < 150125
150 <= X400
TOTAL1820

Thank you in advance.

Regards,

Ashkan

1 Solution

Accepted Solutions
nagaiank
Specialist III
Specialist III

You can use Class() function.

E.g.

LOAD *, Class(Price,25,'X',25) as [Price Range];

A solution using this is attached.

View solution in original post

3 Replies
nizamsha
Specialist II
Specialist II

add calculated dimension in the dimension tab . in that use this one

=class(aggr(sum(total amount),price),50,'')

nizamsha
Specialist II
Specialist II

for equal interval u can use class function

for un equal interval u have to write the condition in script

PriceRange:

LOAD  UnitCost ,

if(total amount>=0 and total amount <=150,Dual('0-50',0-50),

if(

total amount

>50 and total amount <=75,dual('50-75',50-75),

if(

total amount >75 and

total amount <=100,dual('75-100',75-7100),

if(total amount >100 and total amount <=125,dual('100-125',100-125),

if(

total amount

>150,'Above 150')))) as rangePrice

Resident [product] ;

nagaiank
Specialist III
Specialist III

You can use Class() function.

E.g.

LOAD *, Class(Price,25,'X',25) as [Price Range];

A solution using this is attached.