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

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Exclude specific reasons in expression

Hi

This expression is driving me crazy, and the fact that is was done in Tabeau even more!!

I've got an table with different fields, in my expression I want to calculate DOH(direct operating time) but want to exclude specific reasons below is the current expression, but the result does not exclude the reasons duration's as specified in the expression.

sum(if(Match(nEquipmentClassID,35,17)>0 and Match(TimeCategoryCode,1,2)>0,StatusReasonDuration))

/

count(distinct if(  Match(nEquipmentClassID,35,17)>0

              and Match(TimeCategoryCode,3,4,5,6,7,8,9,10) >0

              and  Match(StatusReason,'LIGHTNING/STORM','SCHEDULED NON-PRODUCTION','UNSCHEDULED PRODUCTION STOP','WET/SLIPPERY CONDITIONS') = 0

,nEquipment))

*

24

/

count({<nEquipmentClass=>} distinct if(DateID<=Today(1),Date))

I will appreciate some guidance!

Regards

Ludi

Labels (1)
2 Replies
marcus_sommer
MVP
MVP

Match() is case-sensitive and will therefore find only exact matches - maybe something like this will be helpful:

... match(upper(trim(StatusReason)), ...

- Marcus

sunny_talwar
MVP
MVP

Why do you not try to use set analysis here?

Sum({<nEquipmentClassID = {35, 17}>}, TimeCategoryCode = {1, 2}>} StatusReasonDuration)/

Count(DISTINCT {<nEquipmentClassID = {35, 17}>}, TimeCategoryCode = {3, 4, 5, 6, 7, 8, 9, 10}, StatusReason -= {'LIGHTNING/STORM', 'SCHEDULED NON-PRODUCTION', 'UNSCHEDULED PRODUCTION STOP', 'WET/SLIPPERY CONDITIONS'}>} nEquipment) * 24/

Count({<nEquipmentClass=, DateID = {"$(='<=' & Date(Today(1)))"}>} DISTINCT Date)

Note the negative sign in the set analysis for StatusReason to exclude, instead of include