Convert in a Decimal Value into a Duration 000:00:00 when Column Type is 'Decimal'

I have a column that includes values like 30.6, 4000, 600, etc. so the column type is set to Decimal. There is however, some values that are listed as 0.00723423 or 0.0052342 which actually denote a DURATION. How do you list these these as durations without changing the column type to DURATION (as it wold change the other values which are correctly listed)

See below example highlighted in green. This should be a DURATION, but notice the previous number is listed correctly.

I feel like this would be an IF expression. IF the value is less than 0.1, than do this calculation to covert it to a duration, ELSE, leave the value unchanged.

What do you think?

Solved Solved
0 13 1,235
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

There is no way to display a Decimal value as a Duration directly.

Instead of displaying the column you currently are, add and instead display a virtual column that renders the other columnโ€™s value in the desired way.

View solution in original post

13 REPLIES 13

Steve
Platinum 4
Platinum 4

There is no way to display a Decimal value as a Duration directly.

Instead of displaying the column you currently are, add and instead display a virtual column that renders the other columnโ€™s value in the desired way.

Hi Steve,
How would I then be able to possibly show two columns in one space? Iโ€™m using the CARD VIEW, Iโ€™ve selected the โ€œPEAK METRIC HEADERโ€ which concatenates TWO columns to show the value and unit (ie 160 KM for example). Thereโ€™s only one slot here to pick the header so if I created a virtual column for just the duration piece I wouldnโ€™t be able to show both the PEAK METRIC HEADER and the DURATION (virtual column) header.

Thanks for the advice. Iโ€™ll give this a try. As always, I appreciate your help.

Bahbus
New Member

If you want to do that, make that new VC actually a TEXT column and
CONCATENATE([PEAK METRIC HEADER], " - ", your duration calculation)

Hi Bahbus, how do you convert the decimal number into a duration per your โ€œduration calculationโ€? Here are examples of the decimals being displayed in my app. Thanks!

Bahbus
New Member

The conversion will depend on you. I donโ€™t know what that decimal represents or how you got to it. 0.007337963 hours? days? Either way, youโ€™ll need to multiply it by something to get it to be representative of what you want.

So a duration represented like this 0:09:10

So for example a number like 0.0063657 is the equivalent to 0:09:10 as a duration.

How did the 0.0063657 value get stored in the spreadsheet? From the app? If so, how was the value input?

This value is from a table in google sheets. The 0.0063657 figure is a number format; however, when converted into a duration in google sheets it becomes the 0:09:10 duration format.

In Googleโ€™s duration format, or AppSheetโ€™s?

Googleโ€™s

I donโ€™t know how to convert Googleโ€™s representation of a duration to AppSheetโ€™s.

Ideally, all data in your spreadsheet should be formatted as plain text, and its appearance should be consistent with examples you see in the AppSheet help docs.

Iโ€™d guess 0.0063657 is the percentage of seconds in a day. If so, youโ€™d have to do the math to calculate seconds, minutes, and hours, then construct the Duration value.

Top Labels in this Space