How can I add week ending dates when I have only days of the week?

Hello,
I need to display my starts and ends by week ending dates, but my report only has the start and end daily dates. I added a web form with week ending dates to match the start dates, and then joined the data, which did work, but not sure how to do the same with the actual end date.
Best Answers
-
Using what I showed. If the week ends on Sunday, the formulas change to
DATE_ADD(`StartDate`, CASE WHEN WEEKDAY(`StartDate`) = 1 THEN 0 ELSE 8 - WEEKDAY(`StartDate`) END)
DATE_ADD(`ActualEndDate`, CASE WHEN WEEKDAY(`ActualEndDate`) = 1 THEN 0 ELSE 8 - WEEKDAY(`ActualEndDate`) END)I don't have raw detail records to match your aggregated output. But the aggregate totals should work if your data formula correctly gives Sunday.
Let's say I have a dataset with a bunch of start dates that are all from 12/30/24 through 1/5/25. They should all come out to 1/5/25 as the week end date. And then aggregate the counts to get an output like you show.** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
@ArborRose it can definitely be done in a beastmode, the solution I provided uses a modulus which only works in Magic ETL formulas, not in beastmodes for some reason. That is why I said to use ETL if using my solution.
If I solved your problem, please select "yes" above
0
Answers
-
Try:
DATE_ADD(
date
, INTERVAL (7 - WEEKDAY(date
)) % 7 DAY)
This will not work in a beastmode, you'll have to use the formula tile in Magic ETLIf I solved your problem, please select "yes" above
0 -
Add this in ETL or beast mode?
0 -
ETL. Won't work in beastmode
If I solved your problem, please select "yes" above
0 -
And sorry, I typed it wrong, it should be:
DATE_ADD(date
, INTERVAL (1 - DAYOFWEEK(date
) + 7) % 7 DAY)If I solved your problem, please select "yes" above
0 -
Assuming you want Saturday is your last day of the week, this would get you that date. And this would work in a beast mode or ETL.
DATE_ADD(`dt`, INTERVAL (7- DAYOFWEEK(`dt`)) DAY)
See this excellent post by @GrantSmith for other first and last functionality.
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
Nothing wrong with Colemen's formula, but since you already created a table that you joined on your start dates, you should be able to use that same table and join it a second time to your end dates.
Also, for a BeastMode friendly formula approach, you could leverage the WEEKDAY function, which returns 1 for Sunday, 2 for Monday, etc, so 7 minus the Weekday is the number of days until the end of the week.
date(
Date
+ (7 - WEEKDAY(Date
)))Please 💡/💖/👍/😊 this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
0 -
Why can't you do it on a card?
CompanyName,PositionDateCreated,DateFilled,StartDate,EstimatedEndDate,ActualEndDate,LastDateWorked
Company A,2014-02-25,2014-02-25,2014-03-07,2024-01-01,,2025-05-14
Company B,2014-05-21,2014-05-21,2014-05-19,2025-07-27,,2025-06-15
Company C,2014-09-17,2014-09-17,2014-09-15,2025-03-31,2025-03-31,2025-03-31
Company D,2015-07-30,2015-08-14,2015-08-24,2025-12-31,,2025-06-27
Company E,2017-02-24,2017-04-18,2017-04-20,2025-06-27,,2025-06-27
Company F,2017-12-19,2017-12-20,2017-12-21,2025-07-06,,2025-06-29
Company G,2018-02-12,2018-02-13,2018-02-14,2025-10-05,,2025-06-27
Company H,2018-04-05,2018-04-09,2018-04-16,2025-08-31,,2025-06-26
Company I,2018-06-15,2018-06-15,2018-06-12,2025-03-16,,2025-06-25
Company J,2018-10-05,2018-10-05,2018-10-02,2025-05-23,,2025-06-28
Company K,2018-10-10,2018-10-17,2018-10-18,2024-01-01,,2025-06-28
Company L,2019-01-22,2019-01-22,2019-01-01,2025-11-30,,2025-06-27
Company M,2019-09-19,2019-09-26,2019-09-26,2025-08-26,,2025-06-27
Company N,2019-10-18,2019-10-18,2019-10-29,2025-05-02,2025-03-21,2025-03-21** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
Thank you for all the replies. My week ending date is Sunday, and below is what my starts by week look like. I am having an issue with displaying the same as ends.
0 -
Using what I showed. If the week ends on Sunday, the formulas change to
DATE_ADD(`StartDate`, CASE WHEN WEEKDAY(`StartDate`) = 1 THEN 0 ELSE 8 - WEEKDAY(`StartDate`) END)
DATE_ADD(`ActualEndDate`, CASE WHEN WEEKDAY(`ActualEndDate`) = 1 THEN 0 ELSE 8 - WEEKDAY(`ActualEndDate`) END)I don't have raw detail records to match your aggregated output. But the aggregate totals should work if your data formula correctly gives Sunday.
Let's say I have a dataset with a bunch of start dates that are all from 12/30/24 through 1/5/25. They should all come out to 1/5/25 as the week end date. And then aggregate the counts to get an output like you show.** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
@ArborRose it can definitely be done in a beastmode, the solution I provided uses a modulus which only works in Magic ETL formulas, not in beastmodes for some reason. That is why I said to use ETL if using my solution.
If I solved your problem, please select "yes" above
0 -
@ColemenWilson I'm not smart enough for that fancy math. I have to use fingers and toes.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **1 -
I appreciate all the help, and I am good now. I am using the beast mode, but I will also try the ETL. Thank you again!
0
Categories
- All Categories
- Product Ideas
- 2.1K Ideas Exchange
- Connect
- 1.3K Connectors
- 309 Workbench
- 7 Cloud Amplifier
- 10 Federated
- Transform
- 666 Datasets
- 120 SQL DataFlows
- 2.3K Magic ETL
- 827 Beast Mode
- Visualize
- 2.6K Charting
- 90 App Studio
- 46 Variables
- Automate
- 198 Apps
- 489 APIs & Domo Developer
- 98 Workflows
- 24 Code Engine
- AI and Machine Learning
- 23 AI Chat
- 4 AI Projects and Models
- 18 Jupyter Workspaces
- Distribute
- 118 Domo Everywhere
- 284 Scheduled Reports
- 11 Software Integrations
- Manage
- 145 Governance & Security
- 13 Domo Community Gallery
- 49 Product Releases
- 13 Domo University
- Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 117 Community Announcements
- 5K Archive