Total % of an Item Against All Sales within a Beast Mode
Hello, I would appreciate any help on this one, I'm trying to achieve this in a beast mode to maintain speed.
I have a data set,
Order_date | Item _ID | Order_id | Source | Addon |
Date | 1 | O_1 | site 1 | addon 1
Date | 1 | O_1 | site 1 | addon 2
Date | 2 | O_2 | site 1 | addon 1
Date | 3 | O_3 | site 1 |
I can output this in a table fine to show the correct count of each addon, but I need to show what % each addon is split by source of the total count of item_id. The problem is total count would count each item_id for every addon within that same order. I need to count all unique item_ids to get the total orders, then use the count of the addon to create the % of.
My thinking was an over window function may be able to achieve this by getting the total of all orders first to use to calculate the %, but not having any joy as this will not include any orders that did not have addons.
) OVER( PARTITION BY `source` )
The desired output would be in a pivot table with Source as a column
Addon | % of Total
Addon 1 | 50%
Addon 2 | 25%
Any ideas to solve this problem is greatly appreciated. Apologies if this is unclear but any questions I will try my best to elaborate.
- 10.7K All Categories
- 13 Getting Started in the Community
- 39 Beastmode & Analytics
- 2.1K Data Platform & Data Science
- 59 Domo Everywhere
- 2.7K Charting
- 2.5K Ideas Exchange
- 1.3K Connectors
- 362 Workbench
- 303 Use Cases & Best Practices
- 503 APIs
- 120 Apps
- 48 News
- 753 Onboarding
- 1.2K 日本支部
- Private Company Board