Date arithmetic expression has an invalid operator

My equation is date-date/7 it seems it does not like to divide by 7 though. I am having issues running this expression in appsheet, I do believe it works in google sheets. Iโ€™ve tried changing the value from number to duration in appsheet with no luck. I still get invalid operator error

Solved Solved
0 5 690
1 ACCEPTED SOLUTION

Subtraction operations between 2 values of any Date, Time, or DateTime Types produces a Duration Type. You cannot simply divide a Duration type. It looks like youโ€™re wanting to calculate a number of weeks. Try:

TOTALHOURS( [date] - [date] ) / ( 7 * 24 )

And read this article thoroughly:

View solution in original post

5 REPLIES 5

Steve
Platinum 4
Platinum 4

Please post a screenshot of the complete expression and of the error message.

[Loan Start Date] is type DATE

Subtraction operations between 2 values of any Date, Time, or DateTime Types produces a Duration Type. You cannot simply divide a Duration type. It looks like youโ€™re wanting to calculate a number of weeks. Try:

TOTALHOURS( [date] - [date] ) / ( 7 * 24 )

And read this article thoroughly:

Excellent, it works using TOTALHOURS((today()-[Loan Start Date]))/ ( 7 * 24 ). Appreciate it! Iโ€™ll give that link a read, seems there is a slight difference between sheet and appsheet expression rules

More than a slight difference.

Top Labels in this Space