Sales per Business Day Total
I have a dataset that is structured in the following
Columns: Date, Segment, # Units Sold, and Goal Units Sold.
Rows are by day and segment. (6 segments, 6 rows for each day)
It is joined with a calendar dataset containing a column for the count of business days.
My goal is a table metric, like the attached, that shows # of Units Sold per business day by segment, with a total showing the total Sum of the units sold per business day. What I'm getting with the attached beast mode calculation and table metric seems to be the right rows counts, but then the total is an average, rather than a sum total of the segments combined. How can I end up with the total row equaling the sum of the rows?
There's a lot to unpack here!
1) don't JOIN your date dimension to your transactions to get the day count. instead APPEND the two sets of tables and conform columns so the Transaction Date and CalendarDim_Date line up. Then assign an activity type "Transaction" and "Calendar Count" to differentiate the two datasets.
Why? B/c if you wanted to apply your design pattern to a non aggregated dataset (where you could have multiple transactions in a day, you have to do crazy math to get 'number of days per month'. Where as with my proposed model, you can use a CASE statement on Activity Type to differentiate between activity rows and calendar dimension rows.
I call that design pattern 'stacking' datasets and have an example in this tutorial video:
2) to calculate a percent of total that is partitioned by day you need to use a window function partitioned by day.
I have an example of that here:
You may need to ask your CSM to enable window functions in beast modes.
Hope that helps!
hit me up if you have further questions.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"0
- 10.5K All Categories
- 3 Connect
- 913 Connectors
- 250 Workbench
- 458 Transform
- 1.7K Magic ETL
- 69 SQL DataFlows
- 476 Datasets
- 183 Visualize
- 249 Beast Mode
- 2.1K Charting
- 11 Variables
- 77 Cards, Dashboards, Stories
- 16 Automate
- 354 APIs & Domo Developer
- 88 Apps
- 3 Workflows
- 20 Predict
- 5 Jupyter Workspaces
- 15 R & Python Tiles
- 245 Distribute
- 62 Domo Everywhere
- 242 Scheduled Reports
- 20 Manage
- 41 Governance & Security
- 168 Product Ideas
- 1.2K Ideas Exchange
- 9 Community Forums
- 27 Getting Started
- 14 Community Member Introductions
- 55 Community News
- 4.5K Archive