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
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 655 Datasets
- 115 SQL DataFlows
- 2.2K Magic ETL
- 811 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 80 App Studio
- 45 Variables
- 771 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 77 Workflows
- 23 Code Engine
- 36 AI and Machine Learning
- 19 AI Chat
- AI Playground
- AI Projects and Models
- 17 Jupyter Workspaces
- 410 Distribute
- 120 Domo Everywhere
- 280 Scheduled Reports
- 10 Software Integrations
- 142 Manage
- 138 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 113 Community Announcements
- 4.8K Archive