Tulip Dashboard Analysis: Display error when subtracting 2 dates

Hello,

I want to display the working time according to the days.
To retrieve the work time, we subtract the work end date from the start date like this :

The expression turns red and the result of the calculation is not displayed on the edit page but if we go to the analysis tab of the application then, as we can see on the screenshot here, the result is correctly displayed :

And it doesnt work as well when I try to display these times on a graphic (X =days and Y= SUM(Worktime)

Is there any solution ?

Thank you

Best regards

Inas

Hey @inas.elmoutaakkif -

EDIT: See Grant’s post below

Welcome to community! I filed a bug for this one and linked your app/analytic. You definitely aren’t doing anything wrong here.

Thanks for posting! we will dig into this one and find root cause!
Pete

1 Like

Hi @inas.elmoutaakkif,

I believe the issue is trying to use the SUM operation with an interval data type. Could you click on “modifier”, select “Expression” under “Aggregation Functions” (Fonctions d’Agregation), and use something like SUM(INTERVAL_TO_SECONDS(end - start)).

1 Like

Hello,

Thank you for the reply !

I tried with this way and it works pretty well.

I just have one last question :
Is there a function that allows you to round to 2 digits after the decimal point?


t

Thanks

Best regards

Hi @inas.elmoutaakkif,

You can just wrap the previous expression with the ROUND() expression!

ROUND(SUM(INTERVAL_TO_SECONDS(end - start)), 2)

1 Like

Thank you very much !