Summarize by custom expression: want to divide by a count of distinct values that meet a certain criteria in another field

Hi there. This is my first question, and I’m relatively new to Metabase, but trying to accomplish something that I can’t seem to do using the Custom Expression or using the SQL view, so I thought I’d seek some help.

I have a dataset where I want to get the percent of children who actually attended a program for which they were enrolled, but rather than using the total count of children enrolled as the denominator, I want to use a count of children who attended at least one day (if they never showed up they shouldn’t bring down the percentage). So I got to the point where I am summarizing the dataset, and the numerator is distinct values of Child’s ID, which is good. But then what I need for denominator is a count of distinct values for Child’s ID where the “AttendedOneDay” field =1, and I can’t find a way to do this. It does NOT work to just have a sum of AttendedOneDay because children are in there multiple times in the same table for different months of attendance. So it needs to be a distinct value count, not a sum.

Can anyone help with this?? Thanks in advance.