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
- 311 Workbench
- 7 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 655 Datasets
- 114 SQL DataFlows
- 2.2K Magic ETL
- 811 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 80 App Studio
- 45 Variables
- 769 Automate
- 189 Apps
- 481 APIs & Domo Developer
- 76 Workflows
- 23 Code Engine
- 36 AI and Machine Learning
- 19 AI Chat
- AI Playground
- AI Projects and Models
- 17 Jupyter Workspaces
- 408 Distribute
- 119 Domo Everywhere
- 279 Scheduled Reports
- 10 Software Integrations
- 142 Manage
- 138 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 114 Community Announcements
- 4.8K Archive