Cumulative Count by Month
I am looking to obtain a count of all dates that are less than each month on a table. Please see attachment for reference. In other words, I need a cumulative count of how many enrollments the company has so far going into each month.
The 2019-Dec line should count all dates less than 12/1/2019
The 2020-Jan line should count all dates less than 1/1/2020
The 2020-Feb line should count all dates less than 2/1/2020
and so on...
Is there some way to dynamically reference the date of each line? Almost like curdate, but the date of each line instead.
I hope I have explained this adequately. Thank you in advance for any help I receive.
Comments
-
You could use a Running Total card to automatically build the cumulative totals for you. You could also create a beast mode called DisplayDate (or whatever makes sense to you) that just has a AddDate function in it that would display the next months name instead of the month it is in. This function would do it
ADDDATE(`Date Entrolled`, interval 1 month)
If you don't want to use a Running Total card, you would need to use the Rank & Window Functions in Magic ETL to build the cumulative total.
**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.2 -
If you have window functions enabled in your instance you could do this via a windowed function in a Beast Mode instead of a running total card:
SUM(SUM(1)) OVER (ORDER BY `Date`)
And then utilize @MarkSnodgrass 's solution about adding a month to the date for display purposes via another beast mode.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1 -
@GrantSmith wrote:
If you have window functions enabled in your instance you could do this via a windowed function in a Beast Mode instead of a running total card:
SUM(SUM(1)) OVER (ORDER BY `Date`)
And then utilize @MarkSnodgrass 's solution about adding a month to the date for display purposes via another beast mode.
If you want to count by month then just alter @GrantSmith SQL:
SUM(SUM(1)) OVER (GROUP BY date_format(`DATE`, '%Y%m') ORDER BY `Date`)
In order for it to work, you'll need to have year-month on the axis.
This technique we're introducing is called 'Window Functions' check out the video below for more information!
https://www.youtube.com/watch?v=cnc6gMKZ9R8&t=316s
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"1 -
Dear @jaeW_at_Onyx , how do i know if Windows Function is enable on my instance ?
0 -
@user025461 , contact your Domo CSM or sales representative and ask them to enable the feautre: "window functions in beast mode"
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"-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