Custom count on derived table

I have an events table. The above screenshot show a derived result from events table. It basically shows total number of 'x' event fired by a user in a week.

My business logic says, if a user fires more than 5 events in a week then he is an active user in that week. If a user is active in 2 weeks, then he is loyal user.

I want to plot a graph between week and number of loyal users (users who have been active in 2 weeks in past). I am stuck at this derive table. Please help!

Hi @Lokesh
You would have to use SQL to make such calculations. Metabase GUI cannot do calculations across rows.