"datetimeAdd" how to use a comlumn value as "amount"?

Hello everybody, I am not an expert and I encounter some difficulties with the "datetimeAdd" function.
I have created a customed column which contains an integer (a number of monthes). Let us call this column "My column".
I want to create another customed column which will contain the "current date" + the number of monthes of the previous customed column (ie "My column").

  1. I have tried this syntax : datetimeAdd(now, [My column],"month") and get an error.
  2. I have tried a simplified syntax : datetimeAdd(now, 1,"month"). This works fine (but is of course of no use for me, I don't need Metabase to know which day is tomorrow :slight_smile: )

My question is the following :
Is it possible to create a column containing a date which would be : "the current date" + "A value in monthes contained in another column"

Thank you for your answer

I think you're seeing a sibling of convertTimezone doesn't support target value coming from a column · Issue #33782 · metabase/metabase · GitHub

Thank you Luiggi,
I think you are perfectly right.
I have read the discussion on GitHub and according to me it is anyway a bug (meaning it is obvious that the possibility to add a column containing a number of monthes (days, years, etc.) to a date (like now) is a real need : for example to compute the date when a stock should be at 0 ).
But I understand (according to the Github discussion) that it is not considered so...
Is there any chance to have this issue solved one day or another? And/or is there any possibility to pass through using a special trick ?
Regards

1 Like

Hello, any idea when this would be resolved?

This is a big limitation tbh... We cannot reference another column into the amount of datetimeAdd function. Example:

Cannot use this column in the function

1 Like

Hey, all!

Bumping this. Is this feature still unavailable? The ability to add a variable amount of time to a datetime field has huge potential in a wide variety of use cases.

For instance, my use case is:
We know, based on the size of a job, how long it should take. The job size to duration ratio has been calculated and can be expressed as a fraction.
If I make a custom column – [Expected Duration] = round([Size of Job] * ratio) – then, something as simple as the following would work:

datetimeadd([Start Date], [Expected Duration], “minute”)

This is a pretty universal feature in spreadsheet software – is there really no way to accomplish this in Metabase?

If you’d like to show support for a feature request, give it a thumbs-up reaction in GitHub. Posting bumps here won’t add any attention to the issue.

EDIT: The exact issue here is this one, but the issue linked above is related.

Okay. Made a GitHub account and thumbed it up.

Thanks for the link!