Row Count growth change
Trying to get the %change in overall Row Count DoD looking at today vs. yesterday.
This is what I have but is not successful. Any suggestions?:
(SUM(CASE WHEN DAY(`Snapshot Date`) = CURDATE() THEN `Row Count` ELSE 0 END)
-
SUM(CASE WHEN DAY(`Snapshot Date`) = CURDATE(-1) THEN `Row Count` ELSE 0 END))
/
SUM(CASE WHEN DAY(`Snapshot Date`) = CURDATE(-1) THEN `Row Count` ELSE 0 END)
Answers
-
@renee12345 The CURDATE function does not accept any arguments in side the parenthesis, so you would need to move the -1 outside of the parenthesis in your previous day calculations.
0 -
Oh good call. I'm still not having luck with this query
(SUM(CASE WHEN DAY(`Snapshot Date`) = CURDATE() THEN `Row Count` ELSE 0 END)
-
SUM(CASE WHEN DAY(`Snapshot Date`) = CURDATE()-1 THEN `Row Count` ELSE 0 END))
/
SUM(CASE WHEN DAY(`Snapshot Date`) = CURDATE()-1 THEN `Row Count` ELSE 0 END)
0 -
@renee12345 What result are you currently getting with that calculation, and what result are you expecting?
0 -
I'm currently getting 0 values, expecting high 80s%s
0 -
@renee12345 Here is an example that I believe will work for you. I changed two things. I changed the DAY() function to Date(). The DAY() function returns the numerical day of month (i.e. 15 for Dec 15th, 2022) and Date() will return the actual date (i.e. 2022-12-15). Another change I made was that I added in date_add to ensure it was pulling in yesterday's date. This wasn't necessary as curdate()-1 will also work here as @MichelleH pointed out.
(SUM(CASE WHEN DATE(`Snapshot Date`) = CURDATE() THEN `Row Count` ELSE 0 END)
-
SUM(CASE WHEN DATE(`Snapshot Date`) = DATE_ADD(CURDATE(), interval -1 day) THEN `Row Count` ELSE 0 END))
/
SUM(CASE WHEN DATE(`Snapshot Date`) = DATE_ADD(CURDATE(), interval -1 day) THEN `Row Count` ELSE 0 END)
**Say “Thanks" by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"2 -
Thanks so much! @McSQL !!
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.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