Comparitve Gauge Last Week Vs This Week
I'm trying to create a card to show last week's sales Vs current week's sales, I'm but having issues with the values my beast modes are returning.
The week should start on Monday and end on Sunday. I have our fiscal calendar enabled and checked so I'm not sure if that's causing the issue or not.
Last Week: SUM((CASE WHEN (((YEAR(`filter_date`) = YEAR(CURDATE())) AND (WEEKOFYEAR(`filter_date`) = (WEEKOFYEAR(CURDATE()) - 1))) AND (DAYOFWEEK(`filter_date`) <= (DAYOFWEEK(CURRENT_DATE) - 1))) THEN `premium_amount` END))
This Week: SUM((CASE WHEN (((Year(`filter_date`) = Year(CURDATE())) AND (WEEKOFYEAR(`filter_date`) = WEEKOFYEAR(CURDATE()))) AND (DAYOFWEEK(`filter_date`) <= (DAYOFWEEK(CURRENT_DATE) - 1))) THEN `premium_amount` END))
Best Answers
-
Hi @Mike_Shrift
What specific issues are you having with the values? Without understanding the problem it's hard to help fix it.
Whenever I'm doing Period over Period analysis I utilize a custom date dimension table to help identify this week vs last week for example. I've outlined this process before in the dojo here: A more flexible way to do Period over Period comparisons
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**2 -
Hey, @GrantSmith I'll take a look at the link and let you know if I have any questions.
I'm just not getting the correct results for last week's sales or this week's sales from either of those.
I'm not having any issues with Month to Date and Last Month. I just can't figure out these weekly ones for some reason.
0 -
I plugged your beast modes into a card and replaced your fields with fields from my dataset and I got the correct numbers I would expect for my dataset. That tells me there is likely a data issue either with the filter dates or the premium amounts. I would also check for what field is used in your date range filter and if you have anything in your sorting or filtering properties that would affect it.
I'm also not sure your formulas will work for when the end of the year comes and you need to compare the first week of January with the last week of December. You may want to think about a different option so it will handle that cleanly.
**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.1
Answers
-
Hi @Mike_Shrift
What specific issues are you having with the values? Without understanding the problem it's hard to help fix it.
Whenever I'm doing Period over Period analysis I utilize a custom date dimension table to help identify this week vs last week for example. I've outlined this process before in the dojo here: A more flexible way to do Period over Period comparisons
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**2 -
Hey, @GrantSmith I'll take a look at the link and let you know if I have any questions.
I'm just not getting the correct results for last week's sales or this week's sales from either of those.
I'm not having any issues with Month to Date and Last Month. I just can't figure out these weekly ones for some reason.
0 -
I plugged your beast modes into a card and replaced your fields with fields from my dataset and I got the correct numbers I would expect for my dataset. That tells me there is likely a data issue either with the filter dates or the premium amounts. I would also check for what field is used in your date range filter and if you have anything in your sorting or filtering properties that would affect it.
I'm also not sure your formulas will work for when the end of the year comes and you need to compare the first week of January with the last week of December. You may want to think about a different option so it will handle that cleanly.
**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.1
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.8K Visualize
- 2.5K Charting
- 738 Beast Mode
- 56 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 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