Day or months between two dates

I have list of product batches that have a Batch Creation and Batch Expiry Date as a Date column types.

I have created two virtual columns respectively:

  1. [Batch Expiry] - [Batch Creation]
  2. [Batch Expiry] - [Batch Creation] / 30,4167

I thought I could use the following expressions based on what I saw in other posts:

  1. [Batch Expiry] vs [Batch Creation]
  2. [Batch Expiry] vs [Batch Creation] / 30.4167

I tried using both Number and Decimal column type for the virtual columns but I recieved the following error respectively

The expression is valid but its result type โ€˜Durationโ€™ is not one of the expected types: Decimal

I get the same for Number column type.

What am I missing here?

Solved Solved
0 4 6,157
1 ACCEPTED SOLUTION

The result for this [Batch Expiry] - [Batch Creation] is a duration like hours:minutes:seconds. If you want to have it as days, you should write it like TOTALHOURS([Batch Expiry] - [Batch Creation])/24

View solution in original post

4 REPLIES 4
Top Labels in this Space