2 Replies Latest reply: Jan 23, 2018 4:53 AM by Sunny Talwar RSS

    Exclude specific reasons in expression

    Ludi Du Plooy

      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

        • Re: Exclude specific reasons in expression
          Marcus Sommer

          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
            Sunny Talwar

            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