Skip to main content
Solved

How to calculate automation rate in PQL?

  • March 22, 2023
  • 2 replies
  • 19 views

How to calculate automation rate in PQL?

Best answer by andré.tafur

Hi,

 

Usually you need to include a User Type column in your Activity Table to distinguish if the activity was executed by a human user or if it was executed by automations, with this requirement you could use the following PQL:

 

AVG(CASE WHEN ISNULL("ACTIVITY_TABLE"."USER_TYPE") = 1 THEN NULL

WHEN "ACTIVITY_TABLE"."USER_TYPE" IN(<%=automatic_users%>) THEN 1.0 ELSE 0.0 END)

 

Hope it helps.

2 replies

andré.tafur
Level 8
Forum|alt.badge.img+15
  • Level 8
  • Answer
  • March 22, 2023

Hi,

 

Usually you need to include a User Type column in your Activity Table to distinguish if the activity was executed by a human user or if it was executed by automations, with this requirement you could use the following PQL:

 

AVG(CASE WHEN ISNULL("ACTIVITY_TABLE"."USER_TYPE") = 1 THEN NULL

WHEN "ACTIVITY_TABLE"."USER_TYPE" IN(<%=automatic_users%>) THEN 1.0 ELSE 0.0 END)

 

Hope it helps.


  • Author
  • Level 8
  • March 23, 2023

Hi,

 

Usually you need to include a User Type column in your Activity Table to distinguish if the activity was executed by a human user or if it was executed by automations, with this requirement you could use the following PQL:

 

AVG(CASE WHEN ISNULL("ACTIVITY_TABLE"."USER_TYPE") = 1 THEN NULL

WHEN "ACTIVITY_TABLE"."USER_TYPE" IN(<%=automatic_users%>) THEN 1.0 ELSE 0.0 END)

 

Hope it helps.

Thank you:)