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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Error with IF statements

Can someone please tell me what's wrong with this piece of code

If([Item_POSNR]='CC0000',If([Package Type]='Charter',100,If([Package Type]='Scheduled',1,0)), // ERROR
 
If([Item_POSNR]='TI0000',100, // ERROR
 
Sum(If(Match([VBAP Material Group_MATKL],'01','60'),100,0)+ // ERROR
 
If(Match([VBAP Material Group_MATKL],'02','03','04','62','70'),1,0)))) as TypeSum // ERROR
 

Thanks!

11 Replies
anbu1984
Master III
Master III

This script looks correct to me. Do you still have issues with the script?

[Booking Item]:

LOAD * Inline [

Sales Document,VBAP Material Group_MATKL,VBAP Higher-level item_UEPOS

1,2,3 ];

[Booking Type]:

Load

[Sales Document],

Sum(If([VBAP Material Group_MATKL] = '10' and [VBAP Higher-level item_UEPOS] > '000000', 1, 0))

as [Room Nts],

Sum(If(match([VBAP Material Group_MATKL], '01', '60'), 100, 0) 

+ If(match([VBAP Material Group_MATKL], '02', '03', '04', '62', '70'), 1, 0)) as TypeSum

Resident [Booking Item]

GROUP BY [Sales Document];

Anonymous
Not applicable
Author

[Booking Type]:
Load
[Sales Document],
If([VBAP Material Group_MATKL] = '10' and [VBAP Higher-level item_UEPOS] > '000000', 1, 0)as [Room Nts],// there was no field on which you were summing so no sum aggregation required
If(match([VBAP Material Group_MATKL], '01', '60'), 100, 0) 
+
If(match([VBAP Material Group_MATKL], '02', '03', '04', '62', '70'), 1, 0) as TypeSum

// there was no field on which you were summing so no sum aggregation required
Resident [Booking Item];
// you dont need Group by as though you say typesum but you are not adding fields you are adding static values which is not aggregation.


Left join ([Booking Header])
Load
[Sales Document],
[Room Nts],
If( TypeSum >= 100, 'Charter',
If(TypeSum >= 1, 'Scheduled', 'Land Only') ) as BkgType
Resident [Booking Type];

DROP Table [Booking Type];