can i subtract one date from another
Hi Evan S., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> đź‘‹
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
Yes, you can subtract one date from another in Mixpanel using the datedif
function in custom properties. This function allows you to calculate the difference between two dates in various units.The syntax for the datedif
function is: LBKSdatedif(start_date, end_date, unit)LBKS
Where the unit parameter can be:
- "D": days
- "M": months
- "Y": years
- "MD": days remaining after subtracting whole months
- "YM": months remaining after subtracting whole years
- "YD": days, assuming start_date and end_date are within 1 yearYou can also use TODAY()
as one of the date parameters to calculate the difference from the current date.For example, to find how many months have passed since a user's registration date: LBKSdatedif(registration_date, TODAY(), "M")LBKS
This would return a value like 5
(representing 5 months).This functionality is available in Mixpanel's Custom Properties feature, which allows you to calculate new properties on the fly using formulas.Mixpanel Custom Properties Functions
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.