Converting Decimal Format to Days, Hour, minute format

I'm trying to convert these DATEDIF values from this format that outputs "3.36 days" to the format that reads "3 days, 8 hours, 38 minutes". I would need to be able to average them out too so I don't think a CONCAT function would work. Where should I start?
Answers
-
Hi @austinisenhart,
You can convert 3.36 into separate columns for Days, Hours, and Minutes (e.g., "3 days, 8 hours, 38 minutes"). However, representing the three numbers (3, 8, 38) in a single column without using a string doesn't make any sense. Consider averaging the DATEDIFF as the initial value (3.36) and then presenting the results in a table or chart, including the formatted breakdown ("3 days, 8 hours, 38 minutes") as a Tooltip for clarity.
Here are the Beast Modes I've created:DATE_DIFF:
ROUND(((UNIX_TIMESTAMP(DATE_2
) - UNIX_TIMESTAMP(DATE_1
)) / 60 / 60 / 24) - 0.5, 2)Days:
FLOOR(DATE_DIFF
)Hours:
FLOOR(MOD(DATE_DIFF
* 24, 24))Minutes:
FLOOR(MOD(DATE_DIFF
* 1440, 60))Now if you need to average for ID 'A', average the 191.78 and 223.43 first, and then extract Days, Hours, and Minutes.
DATE_DIFF_AVG:
AVG(DATE_DIFF
) FIXED (BYID
)You can present this info as a Tooltip for the graph:
TOOLTIP
CONCAT(FLOOR(DATE_DIFF
), ' Days, ', FLOOR(MOD(DATE_DIFF
* 24, 24)), ' Hours, ', FLOOR(MOD(DATE_DIFF
* 1440, 60)), ' Minutes, ')If you found this post helpful, please use 💡/💖/👍/😊 below! If it solved your problem, don't forget to accept the answer.
1
Categories
- All Categories
- 1.9K Product Ideas
- 1.9K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 307 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3K Transform
- 112 SQL DataFlows
- 649 Datasets
- 2.2K Magic ETL
- 4K Visualize
- 2.5K Charting
- 790 Beast Mode
- 78 App Studio
- 43 Variables
- 746 Automate
- 187 Apps
- 475 APIs & Domo Developer
- 68 Workflows
- 16 DomoAI
- 40 Predict
- 17 Jupyter Workspaces
- 23 R & Python Tiles
- 406 Distribute
- 117 Domo Everywhere
- 279 Scheduled Reports
- 10 Software Integrations
- 139 Manage
- 136 Governance & Security
- 8 Domo Community Gallery
- 47 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 113 Community Announcements
- 4.8K Archive