Grouped Running Total Bar Card where Each BarValue Consists of a Percentage of a Total in Beastmode.
I am having difficulty making a particular card to work.
I am attempting to make a Grouped Running Total Bar card. But instead of number values... I want the bar to represent a percentage to a total of value in particular fields.
There is one text field called Preference_Type and it contains a '1' or a '2' value, denoting OptIns or OptOuts. I want an OptOut percentage of every running totals months for each `Program_id`.
So...
Total OptOuts/Total Preferences(OptIns+OptOuts)
I added a `Count` field to simplify the beastmode and try various ways to make the calculation... but none of it worked. Bizarrely I would often get different graphs, even when the beastmode code essentially did the exact same thing but expressed differently.
This is an example of my Beastmode calculation...fyi, I changed the Preference_Type field to text to make this easier.
SUM((case when `Preference_Type`= '1' then `Count`*0 when `Preference_Type`='2' then `Count`*1 else `Count`*0 end) / (`Count`))
In theory, this should, for every week, take the totals of each filter's program's OptOuts and divide them by the total Count in that field!!!
I notice the first week is accurate, but the second week doubles the necessary OptOuts, and I have no idea what is going on in the thrid month, just wildly innaccurate. I know the formula is accurate because it works in an all time view that is not running total.
Does the running total graph simply just not have this kind of functionality? Does anyone have any Ideas I can do to work around this. I tried magic ETL extensively, but ultimately was unsuccessful.
Best Answer

You are spot on, Domo's running total visual won't do this for you unfortunately. It just adds current month to previous months over and over again which is why your first month is right but it goes sideways from there.
This is an inelegant solution, but I was able to get it to work using your example data.
On a Grouped Bar chart I used Column 2 as the Category.
And then beastmodes for individual months:
Jan Beastmode
SUM(CASE WHEN `Preference` = 'OptOut' AND MONTH(`Date`) < 2 THEN `Count` ELSE 0 END) / SUM(CASE WHEN MONTH(`Date`) < 2 THEN `Count` END)
Feb Beastmode
SUM(CASE WHEN `Preference` = 'OptOut' AND MONTH(`Date`) < 3 THEN `Count` ELSE 0 END) / SUM(CASE WHEN MONTH(`Date`) < 3 THEN `Count` END)
Mar Beastmode
SUM(CASE WHEN `Preference` = 'OptOut' AND MONTH(`Date`) < 4 THEN `Count` ELSE 0 END) / SUM(CASE WHEN MONTH(`Date`) < 4 THEN `Count` END)
See the attached screenshot for the output.
Hope that works
Domo Consultant
**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"1
Answers

Hi @mrrm17, can you upload (or type out) a short example of your dataset and intended outcomes? You've done a great job of decribing it, it would help me to see examples using values to fully comprehend.
Domo Consultant
**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"0 
Thank you for the reply!!! I created a mock data table.
Date Program Preference Count
1/1/2018 Duck OptIn 1 1/1/2018 Goose OptIn 2 1/1/2018 Thrasher OptIn 5 1/1/2018 Duck OptOut 2 1/2/2018 Goose OptIn 1 1/3/2018 Goose OptOut 2 2/1/2018 Duck OptOut 3 2/2/2018 Thrasher OptOut 1 2/3/2018 Duck OptOut 7 2/4/2018 Goose OptIn 1 2/5/2018 Thrasher OptIn 5 3/1/2018 Duck OptOut 2 3/1/2018 Goose OptOut 1 3/3/2018 Thrasher OptOut 2 So I want to use a Grouped Running Total Graph that takes the OptOut Counts and divide them with the total running total count for that month.
So I would apply a beastmode...
SUM(case when
`Preference`= 'OptOut' then `Count`*1
else `Count`*0
end)
/
SUM(`Count`)
I then separate the running total grouped bar by program and by month. In theory, this calculation should filter by each program and put the running total Count of the particular program in the denominator. I believe this may be where DOMO messes up... I think they are not allowing the denominator be a running total here.
The result should be...
Month Duck Goose Thrasher Jan18 66.7% 40.0% 0.0% Feb18 92.3% 33.3% 54.5% Mar18 93.3% 42.9% 61.5% Thrasher starts out as 0 OptOuts but 5 OptIns... 0/5= 0% . Next month it adds 6 OptOuts and 0 OptIns...6/11= 54.5%. The denominator and numerator are running totals. Third month Thrasher gains 2 OptOuts... 8/13= 61.5%.
0 
You are spot on, Domo's running total visual won't do this for you unfortunately. It just adds current month to previous months over and over again which is why your first month is right but it goes sideways from there.
This is an inelegant solution, but I was able to get it to work using your example data.
On a Grouped Bar chart I used Column 2 as the Category.
And then beastmodes for individual months:
Jan Beastmode
SUM(CASE WHEN `Preference` = 'OptOut' AND MONTH(`Date`) < 2 THEN `Count` ELSE 0 END) / SUM(CASE WHEN MONTH(`Date`) < 2 THEN `Count` END)
Feb Beastmode
SUM(CASE WHEN `Preference` = 'OptOut' AND MONTH(`Date`) < 3 THEN `Count` ELSE 0 END) / SUM(CASE WHEN MONTH(`Date`) < 3 THEN `Count` END)
Mar Beastmode
SUM(CASE WHEN `Preference` = 'OptOut' AND MONTH(`Date`) < 4 THEN `Count` ELSE 0 END) / SUM(CASE WHEN MONTH(`Date`) < 4 THEN `Count` END)
See the attached screenshot for the output.
Hope that works
Domo Consultant
**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"1 
Thank you, That'll have to do!
0
Categories
 All Categories
 1.5K Product Ideas
 1.5K Ideas Exchange
 1.4K Connect
 1.1K Connectors
 283 Workbench
 4 Cloud Amplifier
 4 Federated
 2.7K Transform
 90 SQL DataFlows
 566 Datasets
 2K Magic ETL
 3.4K Visualize
 2.3K Charting
 596 Beast Mode
 13 App Studio
 29 Variables
 595 Automate
 149 Apps
 417 APIs & Domo Developer
 28 Workflows
 1 DomoAI
 28 Predict
 12 Jupyter Workspaces
 16 R & Python Tiles
 362 Distribute
 99 Domo Everywhere
 261 Scheduled Reports
 2 Software Integrations
 97 Manage
 94 Governance & Security
 14 Product Releases
 Community Forums
 37 Getting Started
 28 Community Member Introductions
 90 Community Announcements
 4.8K Archive