How to display week end date instead of week start date when aggregrating daily sales data to weekly
Hi,
I've got daily sales data that is currently aggregated in a WoW view in a bar graph in Domo - but the date on the x-axis shows the week start date. I'm trying to find a way to show the week end date on the x-axis instead in the same format ex: Current x-axis is displaying 2020-08-16 and I just need it to show as 2020-08-22 instead. I've tried various Beast Mode formulas/calculations based on my knowledge of SQL and so far, no luck. Any help would be appreciated!
Thanks,
E.
Comments
-
Hi @EM
You can utilize DAYOFWEEK and some simple math to get the last day of the week.
`Date` + INTERVAL (7 - DAYOFWEEK(`Date`)) DAY
The DAYOFWEEK function returns a number between 1 (Sunday) and 7 (Saturday). Subtracting that from 7 gives us the number of days until the end of the week which we just add that number of days to the exiting `Date` value.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1 -
thank you it works
`startDate`+ INTERVAL (7 - DAYOFWEEK(`startDate`)) DAY
Start date: 12/4/2022 // Week end Date: 12/10/2022
0 -
i, could someone please tell me what is wrong with my case statement below? It validates without any errors, but when I try to load it, I receive the following error: "An issue has occurred during processing. We are unable to complete the request at this time."
I am trying to create a calculated field with the following case statement in order to improve filtering on my report, but I keep encountering the aforementioned error.
Any assistance would be greatly appreciated.
Thank you
CASE
WHENJS Date Added
+ INTERVAL (7 - DAYOFWEEK(JS Date Added
)) then 1
WHENJS Date Added
+ INTERVAL (6 - DAYOFWEEK(JS Date Added
)) then 1
WHENJS Date Added
+ INTERVAL (5 - DAYOFWEEK(JS Date Added
)) then 1
WHENJS Date Added
+ INTERVAL (4 - DAYOFWEEK(JS Date Added
)) then 1
WHENJS Date Added
+ INTERVAL (3 - DAYOFWEEK(JS Date Added
)) then 1
WHENJS Date Added
+ INTERVAL (2 - DAYOFWEEK(JS Date Added
)) then 1
WHENJS Date Added
+ INTERVAL (1 - DAYOFWEEK(JS Date Added
)) then 1
WHENJS Date Added
+ INTERVAL (0 - DAYOFWEEK(JS Date Added
)) then 0
WHENJS Date Added
+ INTERVAL (-6 - DAYOFWEEK(JS Date Added
)) then 0
WHENJS Date Added
+ INTERVAL (-5 - DAYOFWEEK(JS Date Added
)) then 0
WHENJS Date Added
+ INTERVAL (-4 - DAYOFWEEK(JS Date Added
)) then 0
WHENJS Date Added
+ INTERVAL (-3 - DAYOFWEEK(JS Date Added
)) then 0
WHENJS Date Added
+ INTERVAL (-2 - DAYOFWEEK(JS Date Added
)) then 0
WHENJS Date Added
+ INTERVAL (-1 - DAYOFWEEK(JS Date Added
)) then 0
else 3
END0 -
@john_nguyen what are you trying to achieve here? The formula is failing because you're not specifying what the INTERVAL is (DAY, MONTH, etc), once you add that before the THEN on each clause it will no longer fail. However, it's most likely not doing what you want as the WHEN statement is not really returning a logical/boolean true or false, what is the objective of the Beast Mode, in which scenarios would you expect 0 to be returned vs. those where 1 should be returned?
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