Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Dante_83
Contributor III
Contributor III

Show multiple values base on condition

Hi All,
I have two columns labeled Maint Cost and PM Req. Under the PM Req column, I have 'No Maint Req' and 'Maint Req'. I want to create another column that shows 'No Maint Req' cost above $300 (Exclude cost under $300) and Maint Req to show all regardless of cost only.

Below is my expression.
if([PM Req]='No Maint Req',Sum[Maint Cost]>'$300,Sum[Maint Cost])


I got every 'No Maint Req" that is below $300 to show $0. But, 'No Maint Req' above $300, I got a -$1, which I should get all cost value over $300. May someone help? I really appreciate any help you can provide.

Labels (1)
1 Reply
sidhiq91
Specialist II
Specialist II

@Dante_83  Please see the below script and let me know if this is something that you are looking for:

NoConcatenate
Temp:
Load * inline [
MaintenanceCost, PM Req
200,No Maint Req
300,No Maint Req
400,Maint Req
600,Maint Req
800,No Maint Req
900,Maint Req
];

Temp1:
Load *,
if([PM Req]='No Maint Req' and MaintenanceCost>300,MaintenanceCost) as New_Column
Resident Temp
Where [PM Req]='No Maint Req' and MaintenanceCost>300;
Concatenate
Load *,
if([PM Req]='Maint Req' ,MaintenanceCost) as New_Column
Resident Temp
where [PM Req]='Maint Req';
Drop table Temp;

Exit Script;

If this resolves your issue, kindly like and accept it as a soluion.