Skip to main content

Hi all


I have a very basic question – sorry for that, I’m quite new to PQL and I cannot apply the information available online (or did not find it).


I have two tables incident_CASE with column CASE_ID (1-side) and workorder_CASE with column WORKORDER_ID (n-side) (1 incident can have 1 or more workorder).


How can I count the following:

  • Number of incidents with exactly 1 workorder
  • Number of incidents with 2 or more workorder

 

Many thanks for your support
Best
roger


  SUM(
  CASE
    WHEN PU_COUNT("o_celonis_SalesOrder", "o_celonis_SalesOrderItem"."ID") = 1
    THEN 1
    ELSE 0
  END
)

    SUM(
  CASE
    WHEN PU_COUNT("o_celonis_SalesOrder", "o_celonis_SalesOrderItem"."ID") > 1
    THEN 1
    ELSE 0
  END
)
 

The above two PQL expressions should function as intended. Please ensure that the corresponding tables are properly connected in the backend before execution.


Reply