Beast Mode for Aging Bucket
Hi, I'm writing a beast mode to create the aging bucket, it's is showing results but it's has everything under < 15 days. Note sure what I'm doing wrong here.
The 0.06% in 15-30 Days are the negative #
(CASE WHEN ((DATEDIFF(CURRENT_DATE(), `Application Started`)) - (DATEDIFF(CURRENT_DATE(), `Date Assigned`))) <= 15 THEN '15 Days'
WHEN ((DATEDIFF(CURRENT_DATE(), `Application Started`)) - (DATEDIFF(CURRENT_DATE(), `Date Assigned`))) > 15 AND ((DATEDIFF(CURRENT_DATE(), `Application Started`)) - (DATEDIFF(CURRENT_DATE(), `Date Assigned`))) <= 30 THEN '15-30 Days'
WHEN `Application Started` is NULL THEN 'App Not Submitted' END)
Best Answer
-
Your days are negative because your date assigned is coming after the application started date. And because -27 is less than 15 they're all falling into the bucket. You have a few options. One is you can utilize the ABS function to convert any negatives to positive so in you cases where the difference is -27 it'll evaluate to 27 and fill the bucket.
(CASE WHEN ABS((DATEDIFF(CURRENT_DATE(), `Application Started`)) - (DATEDIFF(CURRENT_DATE(), `Date Assigned`))) <= 15 THEN '15 Days' WHEN ABS((DATEDIFF(CURRENT_DATE(), `Application Started`)) - (DATEDIFF(CURRENT_DATE(), `Date Assigned`))) > 15 AND ABS((DATEDIFF(CURRENT_DATE(), `Application Started`)) - (DATEDIFF(CURRENT_DATE(), `Date Assigned`))) <= 30 THEN '15-30 Days' WHEN `Application Started` is NULL THEN 'App Not Submitted' END)
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**2
Answers
-
Hi @Hiraayub
This is because you have your dates swapped. Which date is supposed to come first? You need to do your end date - your start date since the end date will be greater.
Swap `Application Started` with `Date Assigned` such that `Date Assigned` is coming first.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1 -
Grant, our Data is very complicated at the moment there are a lot of manual date entries.
Date Assigned is when we assigned that case to someone to start the application so Date assigned first is right.
<15 days has all the correct data but it not creating the aging bucket < 15 and 15-30.
0 -
Your days are negative because your date assigned is coming after the application started date. And because -27 is less than 15 they're all falling into the bucket. You have a few options. One is you can utilize the ABS function to convert any negatives to positive so in you cases where the difference is -27 it'll evaluate to 27 and fill the bucket.
(CASE WHEN ABS((DATEDIFF(CURRENT_DATE(), `Application Started`)) - (DATEDIFF(CURRENT_DATE(), `Date Assigned`))) <= 15 THEN '15 Days' WHEN ABS((DATEDIFF(CURRENT_DATE(), `Application Started`)) - (DATEDIFF(CURRENT_DATE(), `Date Assigned`))) > 15 AND ABS((DATEDIFF(CURRENT_DATE(), `Application Started`)) - (DATEDIFF(CURRENT_DATE(), `Date Assigned`))) <= 30 THEN '15-30 Days' WHEN `Application Started` is NULL THEN 'App Not Submitted' END)
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**2 -
thank you it worked :)
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive