Forum Discussion

hlister's avatar
hlister
Data Storage
07-16-2025
Solved

Days between x and today

Attempting to create a formula that shows how long our requisition has been opened. I attempted with DDiff(requisition created date, todays date) but formula is unsuccessful. 

  • Hi hlister​ ,

    You are probably attempting to do it in the dashboard, and the error is likely to be "The DDIFF function must be wrapped" in an aggregation function.

    The DDIFF function is not an aggregation, so it calculates the time difference on each row of the underlying response of the generated query. As a result, to be valid, you must indicate an aggregation. So if you are to write something like "DDIFF(Requisition_Create , Now())" you can use MIN, MAX or AVG with the same result if your dimension is the requisition id.

    If you are using a more aggregative dimension, like team id, country, site or something like that, you can use MAX to have the longest time span, or MIN to have the most recent requisition.

    Let me know if this helps.

    Best, David.

3 Replies

  • Hello hlister​,

    I’m following up to see if the solution offered by david-h​ worked for you.

    If so, please click the 'Accept as Solution' button on their post. That way others with the same questions can find the answer. If not, please let us know so that we can continue to help.

    Thank you.

  • Hi hlister​ ,

    You are probably attempting to do it in the dashboard, and the error is likely to be "The DDIFF function must be wrapped" in an aggregation function.

    The DDIFF function is not an aggregation, so it calculates the time difference on each row of the underlying response of the generated query. As a result, to be valid, you must indicate an aggregation. So if you are to write something like "DDIFF(Requisition_Create , Now())" you can use MIN, MAX or AVG with the same result if your dimension is the requisition id.

    If you are using a more aggregative dimension, like team id, country, site or something like that, you can use MAX to have the longest time span, or MIN to have the most recent requisition.

    Let me know if this helps.

    Best, David.

  • Hi hlister​ 

    Would you mind sharing a few more details regarding the formula you are trying to create?

    Are you trying to create it in the model or in the dashboard?

    Is the "created date" a Date-Time format?

    Feel free to share screenshots!