Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
dhruvipanchal88
Contributor III
Contributor III

Mutiple If with Count

I wanted to do count with multiple If condition.  I need help to draft formula for below given case.

Count incident Number, If Incident Assessment Time is 0  or  Incident Clearance Time is 0  or  All Travel Lanes Open Timestamp is 0 .

Labels (3)
2 Solutions

Accepted Solutions
vchuprina
Specialist
Specialist

Hi, 

Data_TMP:
LOAD * Inline[
ID, Incident Assessment Time, Incident Clearance Time, All Travel Lanes Open Timestamp
1, 1, 1, 1
2, 1, 0, 1
3, 1, 1, 0
4, 0, 1, 1
];

You can try the following expression:

Count({<[Incident Assessment Time]={'0'}>+<[Incident Clearance Time]={'0'}>+<[All Travel Lanes Open Timestamp]={'0'}>}ID)

Result:

vchuprina_0-1651091269476.png

Regards,

Vitalii

 

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").

View solution in original post

vchuprina
Specialist
Specialist

Hi, 

I guess it should look like this

Count({<[Incident Assessment Time]={'0'}, [Valid/Invalid Flag] ={''}>+<[Incident Clearance Time]={'0'}, [Valid/Invalid Flag] ={''}>+<[All Travel Lanes Open Timestamp]={'0'}, [Valid/Invalid Flag] ={''}>}ID)

Regards,

Vitalii

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").

View solution in original post

4 Replies
vchuprina
Specialist
Specialist

Hi, 

Data_TMP:
LOAD * Inline[
ID, Incident Assessment Time, Incident Clearance Time, All Travel Lanes Open Timestamp
1, 1, 1, 1
2, 1, 0, 1
3, 1, 1, 0
4, 0, 1, 1
];

You can try the following expression:

Count({<[Incident Assessment Time]={'0'}>+<[Incident Clearance Time]={'0'}>+<[All Travel Lanes Open Timestamp]={'0'}>}ID)

Result:

vchuprina_0-1651091269476.png

Regards,

Vitalii

 

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
dhruvipanchal88
Contributor III
Contributor III
Author

@vchuprina 

I really appreciate your help here. It is working exactly. I need to add one more condition in that formula to count incident number with invalid flags only and it is [Valid/Invalid Flag]={''}.  Can you suggest how should I add it?

vchuprina
Specialist
Specialist

Hi, 

I guess it should look like this

Count({<[Incident Assessment Time]={'0'}, [Valid/Invalid Flag] ={''}>+<[Incident Clearance Time]={'0'}, [Valid/Invalid Flag] ={''}>+<[All Travel Lanes Open Timestamp]={'0'}, [Valid/Invalid Flag] ={''}>}ID)

Regards,

Vitalii

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
dhruvipanchal88
Contributor III
Contributor III
Author

It Worked! Thanks once again.