Mismatch aggregation with distinct count if

I have a dataset like this:

I want to plot a line chart to compare this year eligible test passed count with last year test past count.

My calculated field of this year count is:

This shows error of mismatch aggregation:


I tried to add min/sum outside of distinct_countIf({participant_id}, {new_participant_flag}=1 AND {test passed_flag}=1)/distinct_countIf({participant_id}, {new_participant_flag}=1) but this error still exist.

Appreciate it if anyone could help with this error!

You can try this way:

distinct_count(
ifelse(
extract(‘YYYY’, {activity_date}) = extract(‘YYYY’, now())
AND {new_aprticipant_flag} = 1 AND {test_passed_flag} = 1
,{participant_id}, NULL) )
/
distinct_count(
ifelse(
extract(‘YYYY’, {activity_date}) = extract(‘YYYY’, now())
AND {new_aprticipant_flag} = 1
,{participant_id}, NULL ) )

2 Likes

This works! Thank you!

1 Like