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 the heart icon**
**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 heart in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"3
Categories
 10.6K All Categories
 APAC User Group
 12 Welcome
 36 Domo News
 9.6K Using Domo
 1.9K Dataflows
 2.4K Card Building
 2.2K Ideas Exchange
 1.2K Connectors
 339 Workbench
 251 Domo Best Practices
 11 Domo Certification
 461 Domo Developer
 47 Domo Everywhere
 100 Apps
 703 New to Domo
 84 Dojo
 Domopalooza
 1.1K 日本支部
 4 道場日本支部へようこそ
 22 お知らせ
 62 Kowaza
 295 仲間に相談
 649 ひらめき共有