value_format to show Duration in Days Hours Minutes Seconds doesn't work

I am trying to create a visualization to show the duration as dd days hh hours mm minutes ss seconds format. So the number 1.5 should come up as 01 days 12 hours 0 minutes 0 seconds.


I am using 

value_format: "d\"days\" h\"h\" m\"m\" s\"s\""

It works fine when the number of days is greater than 0. But when it is 0 days, it shows up as 31 days. Any suggestion on what we are doing wrong?

0 4 5,162
4 REPLIES 4

@vickydeepi-1660 

This works. Please try!

value_format: "[>=1]d\"days\" h\"h\" m\"m\" s\"s\";h\"h\" m\"m\" s\"s\""

 

e7577523-0080-4419-b61f-9206bcba0da1.png

The solution @lakshmi-1641424 didn’t work for me until I explicitly defined an [else_format] as documented here. Posting in case anyone gets stuck on this.

can you share your example of how it works? thank you

Beware that solutions presented here fail in subtle ways that makes it display incorrect information in case of either negative durations or durations longer than a month. My suggestion is to stick with `[h]` that will show untruncated hours, either negative or positive. Uglier but correct.

(Sorry for bumping old thread, but this is high up in the search results)

Top Labels in this Space
Top Solution Authors