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
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)
3
Hey, Stranger!