Cumulative Sum for the Year on a table card

I want to create a table card that has a line for each month-year for all sales and show total $ for the month, a running total of $ for the year (up to that point), total quantity sold for the month, and a running total of quantity sold for the year (up to that point).
Example:
Month-Year | Monthly $| Running $ | Monthly Quantity | Running Quantity
January 2024 | $100 | $100 | 10 | 10
February 2024 | $50 | $150 | 5 | 15
….
December 2024 | $100 | $1200 | 10 | 120
January 2025 | $30 | $30 | 3 | 3
February 2025 | $20 | $50 | 2 | 5
If you use the "Show Value As" parameter when you click on the variable in the card, it does not allow you to group the data at all so it just adds every line up over every year.
Best Answer
-
Hi @zaclingen_fwm,
You can do this with a window function:
SUM(SUM(`Monthly $`)) OVER (PARTITION BY `year` ORDER BY `month number` )
1
Answers
-
Hi @zaclingen_fwm,
You can do this with a window function:
SUM(SUM(`Monthly $`)) OVER (PARTITION BY `year` ORDER BY `month number` )
1 -
This was so close to what I had. Thank you
1
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 310 Workbench
- 7 Cloud Amplifier
- 9 Federated
- 3K Transform
- 113 SQL DataFlows
- 651 Datasets
- 2.2K Magic ETL
- 4K Visualize
- 2.5K Charting
- 795 Beast Mode
- 78 App Studio
- 44 Variables
- 755 Automate
- 187 Apps
- 480 APIs & Domo Developer
- 71 Workflows
- 17 DomoAI
- 40 Predict
- 17 Jupyter Workspaces
- 23 R & Python Tiles
- 407 Distribute
- 118 Domo Everywhere
- 279 Scheduled Reports
- 10 Software Integrations
- 141 Manage
- 137 Governance & Security
- 8 Domo Community Gallery
- 47 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 113 Community Announcements
- 4.8K Archive