Last Month in Custom Expression

I created a custom question with a custom expression to determinate the “churn rate”.
In this custom expression i have a “CountIf” and a time compare.

That’s my custom expression:
CountIf(between([Cancelation Date], “2020-04-01”, “2020-04-30”)) / CountIf([Status → Status] != “Canceled” AND [Status → Status] != “Inactive”)

Has any method to always get the last month period in the time compare inside my custom expression?

Hi @yuriandreoli
No, currently there’s not many date expressions (besides the between with static dates), but there’s a request:
https://github.com/metabase/metabase/issues/11330 - upvote by clicking :+1: on the first post

Thanks @flamber!

@yuriandreoli Wait a minute, it’s actually already possible:

interval([Cancelation Date], -1, "month")

We just haven’t documented that expression:
https://www.metabase.com/docs/latest/users-guide/expressions.html

3 Likes

Awesome!
Worked perfectly here!