Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
justISO
Specialist
Specialist

Filter alternative without ifs

Hi all, maybe someone could suggest a better idea how to create 'more correct' filter without ifs, because, let's say we have simple table with some indicators:

 

load * inline [
id, ind_Recognision, ind_Delete, ind_Return
A,	1,				0,			0
B,	1,				1,			0
C,	1,				1,			0
D,	0,				1,			0
E,	0,				1,			0
F,	0,				0,			1];

 

If I want to create a filter to know what 'action' (according indicators) were done, simplest way to do is using ifs:

 

=IF(ind_Recognision=1, 'Recognition', if(ind_Delete=1, 'Delete', if(ind_Return=1, 'Return', 'Other')))

 

But here comes my problem, basically, ifs take only first value where expression is true. So if I choose 'Delete', I only see ids D and E, because B and C already treated as 'Recognition'.

Is there a way to create a filter which take not 'first true value', but looks 'if one of' way? So if I choose 'Delete' I will see B, C, D, E ids.

Thank you in advance

Labels (1)
1 Solution

Accepted Solutions
Or
MVP
MVP

Table1:

load * inline [
id, ind_Recognision, ind_Delete, ind_Return
A,	1,				0,			0
B,	1,				1,			0
C,	1,				1,			0
D,	0,				1,			0
E,	0,				1,			0
F,	0,				0,			1];

 

Load id, 'Recognition'  as Action

Resident Table1

Where ind_Return = 1;

JOIN

Load id, 'Delete' as Action

Resident Table1

Where ind_Delete = 1;

JOIN

Load id, 'Return' as Action

Resident Table1

Where ind_Recognision = 1;

JOIN

Load id, 'Other' as Action

Resident Table1

Where ind_Recognision = 0 AND ind_Delete = 0 and ind_Return = 0;

View solution in original post

1 Reply
Or
MVP
MVP

Table1:

load * inline [
id, ind_Recognision, ind_Delete, ind_Return
A,	1,				0,			0
B,	1,				1,			0
C,	1,				1,			0
D,	0,				1,			0
E,	0,				1,			0
F,	0,				0,			1];

 

Load id, 'Recognition'  as Action

Resident Table1

Where ind_Return = 1;

JOIN

Load id, 'Delete' as Action

Resident Table1

Where ind_Delete = 1;

JOIN

Load id, 'Return' as Action

Resident Table1

Where ind_Recognision = 1;

JOIN

Load id, 'Other' as Action

Resident Table1

Where ind_Recognision = 0 AND ind_Delete = 0 and ind_Return = 0;