Beast Mode - Grouping
Hi! I am trying to fix this beast mode calculation
to group properly. I need the time to group 12am-6am and then show 7am-7pm as separate lines and then group 8pm-11:59pm. The opened date column i am using is in this format '2023-10-22T07:18:17' which is why I am trying to use the beast mode, but the grouping doesn't seem to be working as expected, any suggestions?
Best Answers
-
The issue you're having might be related to how the hour (%k format) is being evaluated for ranges.
DATE_FORMAT function returns a string, not an integer. What about something like…CASE
WHEN NUMBER(DATEPART('hour', Opened Date)) >= 0 AND NUMBER(DATEPART('hour', Opened Date)) < 6 THEN '12am-6am'
WHEN NUMBER(DATEPART('hour', Opened Date)) >= 6 AND NUMBER(DATEPART('hour', Opened Date)) < 19 THEN CONCAT(NUMBER(DATEPART('hour', Opened Date)), 'am')
WHEN NUMBER(DATEPART('hour', Opened Date)) >= 19 AND NUMBER(DATEPART('hour', Opened Date)) <= 23 THEN '8pm-11:59pm'
ELSE 'Other'
END** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
I believe you can have a more consolidated beast mode using the hour and concat functions and stacking the statements in the correct order
CASE WHEN HOUR(
startdate
) < 6 THEN '12am-6am'
WHEN HOUR(startdate
) < 12 then CONCAT(HOUR(startdate
),'am')
WHEN HOUR(startdate
) < 20 THEN CONCAT(HOUR(startdate
)-12,'pm')
ELSE '8pm-11:59m'
END**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0
Answers
-
Do you have a sort applied to your card? Remove it and see if it groups properly.
If I solved your problem, please select "yes" above
0 -
The issue you're having might be related to how the hour (%k format) is being evaluated for ranges.
DATE_FORMAT function returns a string, not an integer. What about something like…CASE
WHEN NUMBER(DATEPART('hour', Opened Date)) >= 0 AND NUMBER(DATEPART('hour', Opened Date)) < 6 THEN '12am-6am'
WHEN NUMBER(DATEPART('hour', Opened Date)) >= 6 AND NUMBER(DATEPART('hour', Opened Date)) < 19 THEN CONCAT(NUMBER(DATEPART('hour', Opened Date)), 'am')
WHEN NUMBER(DATEPART('hour', Opened Date)) >= 19 AND NUMBER(DATEPART('hour', Opened Date)) <= 23 THEN '8pm-11:59pm'
ELSE 'Other'
END** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
I believe you can have a more consolidated beast mode using the hour and concat functions and stacking the statements in the correct order
CASE WHEN HOUR(
startdate
) < 6 THEN '12am-6am'
WHEN HOUR(startdate
) < 12 then CONCAT(HOUR(startdate
),'am')
WHEN HOUR(startdate
) < 20 THEN CONCAT(HOUR(startdate
)-12,'pm')
ELSE '8pm-11:59m'
END**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 101 SQL DataFlows
- 622 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 747 Beast Mode
- 59 App Studio
- 41 Variables
- 686 Automate
- 176 Apps
- 453 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 396 Distribute
- 113 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 126 Manage
- 123 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 109 Community Announcements
- 4.8K Archive