How to calculate number of cases that repeat an activity

Hi!

I’m trying to calculate how many cases have a certain activity less or more than X times, etc.

I have this table A which shows number of cases that have a certain activity, and total sum of this activity. As you can see, the activity is repeated many times in a few cases.

I want to separate in ranges, I’m using this formula but I get the total number of activities and not the number of cases. (Table B)

SUM(CASE WHEN
PU_COUNT("_CEL_PS_PO_LINE", “CEL_P2P_ACTIVITIES"."ACTIVITY<%=language%>”)<=10 THEN 1.0
ELSE 0.0 END)

Could you please help me know what I’m doing wrong?

Thank you!

Table A
image

Table B

1 Like