Count specific activities

Hello everyone,

currently I am trying to calculate the KPI for the number that an activity is occuring overall.

I tried this formula:
COUNT(CASE WHEN “Activity_Table”.“Activity_Column” = ‘Selected_Activity’ THEN 1 ELSE 0 END)
Obviously it did not work. It gives me the result of all my activities/rows from the whole table.

I actually do not get why it does not work.
I am very grateful for help

Kind regards
Matthias

Hi Matthias,

COUNT will count the number of rows in your column except NULL-values. So 1 and 0 both count 1 because they are not NULL. You can either use SUM instead of COUNT or use NULL instead of 0 in your ELSE part. The last option is faster, but both should give you the result you expect.

Cheers
David