How do you change a date to a digit to get a sum?
I have a column that has the completion date. I'd like to change that to a number 1, so I can calculate how many have been completed.
If completion date equals 6/12/2023, 6/13/2023, 6/14/2023, 6/15/2023, or 6/16/2023 then change each of those values to the number 1
Best Answer
-
@ScottLeeds You can create a numeric field that you can sum through either a beast mode or ETL formula tile like this:
case when `Completion Date` >= '2023-06-12' and `Completion Date` <= '2023-06-16' then 1 else 0 end
0
Answers
-
@ScottLeeds You can create a numeric field that you can sum through either a beast mode or ETL formula tile like this:
case when `Completion Date` >= '2023-06-12' and `Completion Date` <= '2023-06-16' then 1 else 0 end
0 -
@MichelleH thank you! do you know if there is a way to format it to be current day of the week, or prior week day instead of specific dates? this would help to automate it.
0 -
@ScottLeeds Yes, you can use a rolling 7 days approach like this:
case when `Completion Date` >= CURRENT_DATE() - 7 then 1 else 0 end
0 -
@MichelleH thank you. the rolling 7 days is working for us. we would also like to capture dates that are 7-14 days ago, or another way to look at it would be the week prior to the last 7 days. I can't figure out how to do that. Any thoughts? And your help is greatly appreciated.
0 -
@ScottLeeds To count the whether the completion date was 7-14 days ago, you can add a second condition to your case statement like this:
case when `Completion Date` >= CURRENT_DATE() - 14 AND `Completion Date` < CURRENT_DATE() - 7 then 1 else 0 end
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