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
- Product Ideas
- 2.1K Ideas Exchange
- Data Connections
- 1.3K Connectors
- 309 Workbench
- 17 Cloud Integrations
- Data & ETL
- 2.3K Magic ETL
- 120 SQL DataFlows
- 666 Datasets
- 827 Beast Mode
- Visualize & Apps
- 90 App Studio
- 198 Pro-code Components
- 2.6K Charting & Analyzer
- 46 Calculations & Variables
- AI & Data science
- 23 Domo AI & AI Chat
- 4 Managing AI
- 18 Jupyter Workspaces
- 122 Workflows
- Distribute
- 118 Domo Everywhere
- 284 Reporting
- Manage
- 145 Governance & Security
- 489 APIs
- 11 Add-ins & Plugins
- 13 Domo Community Gallery
- 49 Product Releases
- 13 Domo University
- Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 117 Community Announcements
- Automate
- 5K Archive