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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
bhaveshp90
Creator III
Creator III

How to write script for the given condition?

Hello,

I have created a backend script for my filter as;

If(Code = '3', 'Mechanical',

If(Code = '4', 'Controls',

If(Code = '5', 'System'))) as Engineering,

But I want to create another condition combining Code = '3', Code = '4', Code = '5' as Total in the same Engineering Category.

Any idea on how to do this?

thanks

Bhavesh

1 Solution

Accepted Solutions
sunny_talwar

Concatenate to the above table

LOAD 'Total' as Engineering

from ...

where Match(Code, 3, 4, 5);

View solution in original post

2 Replies
sunny_talwar

Concatenate to the above table

LOAD 'Total' as Engineering

from ...

where Match(Code, 3, 4, 5);

bhaveshp90
Creator III
Creator III
Author

thank you stalwar1‌,  I have now Total added as another condition for my filter "Engineering". But the Expression for my Sales is not filtering. This is how my expression is;


=if(Code = '3', Sum(Sales_3),

if(Code = '4', Sum(Sales_4),

if(Code = '5', Sum(Sales_5))))

//Script:

y:

NoConcatenate Load

*,   

If(Code = '3', 'Mechanical',

If(Code = '4', 'Controls',

If(Code = '5', 'System'))) as Engineering,

Resident x;


Left Join (y)

Load

if(Cost_Code = '3', Sales,0) as Sales_3,

if(Cost_Code = '4', Sales,0) as Sales_4,

if(Cost_Code = '5', Sales,0) as Sales_5,

Resident y

LOAD

'Total' as Engineering

Resident y

where Match(Code, 3, 4, 5);


Can you tell me what is wrong here? thanks