Compare running total today vs. on the same weekday last week

I’m looking for a way to calculate revenue up to a selected hour today vs. the revenue up to the same hour but one week ago, on the same weekday. Would be nice to see an example.
Thanks

Can you try something like this?

sumOver(ifelse(truncDate(‘DD’,{event_timestamp})=truncDate(‘DD’,now()),{arrival_timestamp_int},0),,PRE_AGG) - sumOver(ifelse(truncDate(‘DD’,{event_timestamp})=addDateTime(-7,‘DD’,truncDate(‘DD’,now())),{arrival_timestamp_int},0),,PRE_AGG)

Essentially it will check if you timestamp is today then sum it. Then it will check if the timestamp is 7 days before and sum that value. Finally it will subtract the two.

Let me know if that works.

Thanks, @Max .
There are couple of weird symbols in your text. Can you use the code formatting please?

sumOver(ifelse(truncDate('DD',{event_timestamp})=truncDate('DD',now()),{arrival_timestamp_int},0),[],PRE_AGG) - sumOver(ifelse(truncDate('DD',{event_timestamp})=addDateTime(-7,'DD',truncDate('DD',now())),{arrival_timestamp_int},0),[],PRE_AGG)

Doesn’t work for me. Looks like something is missing - what is being summed over?

I am summing over the metric.

Can you give more details? Have you taken the avg / sum of this?