How to create a weekly YTD

I need to create a week-by-week report of a feature usage by customers similar to this:
(ignore the numbers in the YTD column)

My dataset looks like this:

(sample_date, customer_name, server_id, is_feature_enabled)

where sample_date is a running date repleated daily even if there is no change in the data.

The visual is constructed as
sample_date aggregated by Week
distinct_countIf({customer_name}, {is_feature_enabled}=1)
distinct_count({customer_name})

My question is: how do I compute a weekly YTD?
It should be the same as the second column, i.e. the distinct count of customers but for the time range of year start - row's week

Note that this is not a running total, as the same customer using the feature during several weeks is counted as one. E.g. theoretically all columns can have same value throughout the year, if all customers use the feature all the time.

Thanks!

HI @kofmand
maybe you can have a look at:

or

BR

1 Like

Thanks @ErikG
While not exactly a solution but your first link led me to check the periodToDate*OverTime which helped me achieve what I need. I’ll post the solution below.

Here’s the solution I found - perhaps it would be helpful to somebody.
I defined a calculated field feature user as
ifelse({is_feature_enabled}=1, {customer_name}, NULL),

and then the ytd field as
periodToDateMaxOverTime(distinct_count({feature user}), {sample_day}, YEAR)