Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
ludiduplooy
New Contributor

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

2 Replies

Re: Exclude specific reasons in expression

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

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

- Marcus

Re: Exclude specific reasons in expression

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

Community Browser