Doug Creighton
05/22/2024, 7:02 PMFrancisco Antunes
05/22/2024, 7:11 PMDoug Creighton
05/22/2024, 7:13 PMFrancisco Antunes
05/22/2024, 7:19 PMMichal HauzĂrek
05/22/2024, 9:10 PMSELECT ...
WHERE IFNULL(metric1,0) = 1
AND ( IFNULL(metric2,0) = 0 OR IFNULL(metric3,0) = 0 )
If I am not mistaken, during the calculation, each (sub)metric is evaluated as if it was independent and the individual results are inner-joined to evaluate the outer metric.
And without IFNULL if any of the three combined metrics does not have a value defined for a particular resulting row (is NULL), this row will fall out of the result.
Which might be the case here, if you say the “existed before” are actually NULLs.Doug Creighton
05/23/2024, 1:13 PMSELECT IFNULL(SELECT
COUNT({label/local_user_id})
WHERE {label/case_opened.weekOfYear} = PREVIOUS(WEEKOFYEAR),0
)
Before Previous Week
SELECT IFNULL(
SELECT COUNT({label/local_user_id})
WHERE {label/case_opened.weekOfYear} < previous(WEEKOFYEAR)
AND {label/case_opened.monthOfYear} >= previous(MONTHOFYEAR)
,0)
First Week
Tried both
This one just was NULL
SELECT COUNT({label/local_user_id})
WHERE IFNULL({metric/agents_online_-_previous_week} ,0) = 1
AND IFNULL({metric/agents_online_in_previous_time},0) = 0
This one just removed any 1,0 rows and made everything else 0
SELECT IF
IFNULL({metric/agents_online_-_previous_week} ,0) = 1
AND IFNULL({metric/agents_online_in_previous_time},0) = 0
THEN 1 ELSE 0 END
Michal HauzĂrek
05/27/2024, 10:20 PMSELECT COUNT({label/local_user_id})
FOR EACH {label/local_user_id}
WHERE IFNULL({metric/agents_online_-_previous_week} ,0) > 0
AND IFNULL({metric/agents_online_in_previous_time},0) = 0
This should work if you are viewing your data by local_user_id.
If you also needed it to work when viewed globally (without local_user_id in the bucket), this more robust metric with inner metrics should work:
SELECT COUNT({label/local_user_id})
FOR EACH {label/local_user_id}
WHERE (SELECT IFNULL({metric/agents_online_-_previous_week} ,0) BY {label/local_user_id}, ALL OTHER ) > 0
AND (SELECT IFNULL({metric/agents_online_in_previous_time},0) BY {label/local_user_id}, ALL OTHER) = 0
I hope this helps.Michal HauzĂrek
05/27/2024, 10:27 PM{...monthOfYear} = previous(MONTHOFYEAR)
is not just April 2024
but also April 2023
, April 2022
and any other April. The same case is with the weekOfYear vs Week.
If you just want “normal” sequential previous month and previous week, you might want to change
• the {....monthOfYear} = previous(MONTHOFYEAR)
to {...month} >= previous(MONTH)
• and {...weekOfYear} = previous(WEEKOFYEAR)
to {...week} < previous(WEEK)
Doug Creighton
05/30/2024, 5:21 PMSELECT count({label/user_id})
WHERE(
SELECT IFNULL(AVG({metric/workflow_completion_percent-_store_comms}),0)
BY {label/user_id}
) = 0
SELECT IFNULL(SELECT{metric/workflow_completion_-_store_comms_2}/{metric/analyzed_-_store_comms_2}
WHERE {label/workflow_workflows} = "storecomms"
and {fact/workflow_clicked_workflows} = 1
,0)
Doug Creighton
05/30/2024, 5:21 PMMichal HauzĂrek
06/03/2024, 9:43 AMFOR EACH {label/local_user_id}
to the outer metric should help:
SELECT count({label/user_id})
FOR EACH {label/local_user_id}
WHERE(
SELECT IFNULL(AVG({metric/workflow_completion_percent-_store_comms}),0)
BY {label/user_id}
) = 0