Forum Discussion

AllanBerces's avatar
AllanBerces
Post Prodigy
9 months ago
Solved

Containsstring and Count

Hi good day 

Can anyone help me on my calculated column, i have two table that connected. I want to count the number of Job.

 

DESIRED OUTPUT

 

Table Connection

 

 JC Count =
CALCULATE(
    COUNTROWS(MAIN_DATA),
    FILTER(
        'MAIN_DATA',
        (CONTAINSSTRING('MAIN_DATA'[Job No.], "LP") || CONTAINSSTRING('MAIN_DATA'[Job No.], "LS") || CONTAINSSTRING('MAIN_DATA'[Job No.], "LI") || CONTAINSSTRING('MAIN_DATA'[Job No.], "LM"))
        &&
        NOT CONTAINSSTRING('MAIN_DATA'[Job No.], "QF")
        &&
        NOT CONTAINSSTRING('MAIN_DATA'[TQ], "SQ")
    )
)
 
Thank you
  • Ahmedx's avatar
    Ahmedx
    9 months ago

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

17 Replies

  • попробуй удалить ALL

    L Count = 
    VAR _KewSearch= SELECTCOLUMNS( {"LS","LP"},"KeyWord",[Value])
     VAR _Result = COUNTROWS(FILTER('MAIN_DATA TABLE','MAIN_DATA TABLE'[Code] in _KewSearch))
    RETURN
    _Result
    • Ahmedx's avatar
      Ahmedx
      Super User

      pls try

      Q Count = 
      VAR _KewSearch= SELECTCOLUMNS( {"QP","QF","QK","QL"},"KeyWord",[Value])
      VAR _Cod = MAX('MAIN_DATA TABLE'[Main No])
       VAR _Result = COUNTROWS(FILTER(ALL('MAIN_DATA TABLE'),'MAIN_DATA TABLE'[Code] in _KewSearch&&'MAIN_DATA TABLE'[Main No]=_Cod))
      RETURN
      _Result
      -----------------
      L Count = 
      VAR _KewSearch= SELECTCOLUMNS( {"LS","LP"},"KeyWord",[Value])
      VAR _Cod = MAX('MAIN_DATA TABLE'[Main No])
       VAR _Result = COUNTROWS(FILTER(ALL('MAIN_DATA TABLE'),'MAIN_DATA TABLE'[Code] in _KewSearch&&'MAIN_DATA TABLE'[Main No]=_Cod))
      RETURN
      _Result
    • AllanBerces's avatar
      AllanBerces
      Post Prodigy

      Hi Ahmedx thank you for the reply but it count the overall instead of per Main No. Please note my MAIN DATA TABLE, Main No column has many different no.

      DESIRED OUTPUT

      Thank you