Market Share (% of Total) and % Change/Trend Calculations
Is there a way using beast mode, or some other functionality, to create the following two equations in a DOMO card — to display on graphs as well as in a table/pivot table.
1) Market Share as a percent of total. In other platforms like PowerBI with DAX this would be achieved with something like the following random example: Sum(Sales)/Calculate(Sum(Sales),All(Colors). The idea being on a row where the color is red, it would divide the sales figures for red by the total sales for all colors. Numerator = red sales, denominator = total sales.
If that cannot be done in a beast mode, is there a way through other functionality to represent the % of total for a given column within a pivot table card? As in the value in a row divided by the sum of that column?
2) Is there a way with beast modes to calculate period over period trend? E.g. using a pivot table card If I had Color (Red) in the rows, and Months (Jan, Feb, March...Dec.) in the columns I would want to be able to calculate the % change month over month, in an excel formula it would be: (Red February Sales / Red January Sales) 1 copy that formula across to get MoM trend %, how do you do this in DOMO? I would imagine people report on these types of metrics with domo. I have quite a bit of experience with Power BI and Tableau, but still learning DOMO.
Any Help would be wonderful! Thank you in advance!
Comments

Hi @Bwaalsh
1) It sounds like you're wanting to do a windowing function. This is possible within Domo as a beast mode however you need to have the feature switched on in your instance. If you don't have it you'll need to talk to your CSM.
Something like:
SUM(`Sales`) / SUM(SUM(`Sales`)) OVER (PARTITION BY `Color`)
2) Domo can do this internally within Analyzer / Card Editor using a Period over Period type graph and editing the values in the Date Selector (upper right of your canvas). You can defined which period type you're wanting and it will calculate it for you. If you're wanting more flexibility surrounding there is a more complex method of structuring your data in a different way so that you join to a date dimension table calculating the period types manually. I've written about this previously here: https://dojo.domo.com/discussion/comment/50540#Comment_50540
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**3 
+1 @GrantSmith except it sounds like you need to add a partition. @Bwaalsh,
sum(Sales) / sum(sum(sales)) over (partition by colors)
I actually just posted a video involving window functions (https://www.youtube.com/watch?v=Esnu1PSxRjM&t=35s)
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"3
Categories
 7.7K All Categories
 5 Connect
 921 Connectors
 244 Workbench
 477 Transform
 1.8K Magic ETL
 60 SQL DataFlows
 446 Datasets
 40 Visualize
 199 Beast Mode
 2K Charting
 8 Variables
 1 Automate
 348 APIs & Domo Developer
 82 Apps
 Workflows
 14 Predict
 3 Jupyter Workspaces
 11 R & Python Tiles
 241 Distribute
 59 Domo Everywhere
 241 Scheduled Reports
 15 Manage
 36 Governance & Security
 28 Product Ideas
 1.1K Ideas Exchange
 Community Forums
 14 Getting Started
 1 Community Member Introductions
 49 Community News
 18 Event Recordings
 579 日本支部