Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
TestUser152
Contributor
Contributor

Sum If greater or less in Classes

Hello everybody, I need your help.


I have a record with project name, their value and a percentage.

Now I want to divide the whole into classes (see table).

ClassPercentage
A1
B>0,9
C0,9< >0,75
D0,75< >0,50
E<0,5

 

The respective class "D" should then sum up all projects that have a percentage between 75 and 50 percent. The result should look like in the table.

ClassProjectnamePercentagesum(Value)
A 1500000
 AB1,00250000
 CD1,00250000
    
B >0,9340000
 DF0,95113333
 EA0,90113333
 GG0,97113333
    
C 0,9< >0,75300002
 AD0,80150001
 SD0,89150001
    
D 0,75< >0,50201244
 XX0,60201244
    
E <0,5100000
 Q0,10100000


I wanted to show it in a ValueList and implement it with Sum IF and so on. However, I just can not get the class division.

(=IF(ValueList('A','B','C,'D','E') = 'C', sum(if([Percentage] >0,75 or [Percentage]<0,9, [Value]))…….)

 

The whole I would then want to show in a bar chart.

 

Thanks for your help.

1 Reply
Vegar
MVP
MVP

image.png

try:

 

ProjectTrans:
LOAD * inline [
Projectname,Percentage,Value
AB,1,250000
CD,1,250000
DF,0.95,113333
EA,0.9,113333
GG,0.97,113333
AD,0.8,150001
SD,0.89,150001
XX,0.6,201244
Q,0.1,100000
];

Class:
LOAD * inline [
Class, 	Percentage_from,Percentage_to
A,		1,				1
B,		0.9,			0.999999
C,		0.75,			0.899999
D,		0.5,			0.749999
E,		0,				0.499999
];

left join(ProjectTrans)
IntervalMatch (Percentage)
LOAD Percentage_from,Percentage_to
Resident Class;
Drop field Percentage_from;