How can I calculate a percent of total in a Beast Mode?
I'm trying to perform a percent of total calculation in a Beast Mode column - who can help?
More details:
In Excel, I would do something like this: $B2/SUM($B$2:$B$10)
Here's the catch - I have certain "groups" in Column A, for example, that need to be filterable, with the percent of total calculation updating with the filter.
Domo performs the filtering gracefully, but I do not know how to do the percent total. This Beast Mode attempt seemed obvious:
=`unit sales`/sum(`unit sales`)
Problem with the above... when we use it, we just get "no data" or whatever Domo says when you've input a technically valid, though ultimately useless, formula.
So, in my head I want to use a "SumIf" function from Excel like this:
= `unit sales`/sumif(`group name`,"= the filtered group name",`unit sales`)
I know I can do this with a pie chart without any Beast Mode schenanigans, but I want the results displayed side by side in a bar chart.
Final example: I have 100 retail locations in three states; ME, NH, VT. In January, Coke had 30% of soda sales across all three states, Pepsi had 50%, other brands = 20%. Now, I want to filter by state. Select ME from the Analyzer box, and those % totals should update (ex: in ME, Coke = 40%, Pepsi = 30%, Other = 30%).
Comments
-
is your x-axis going to be dates or a category? in other words are you going to show trend over time or a snapshot as of a certain date? Trend will be more difficult and i think you'll have to include your Total (your denominator) as a separate column in your dataset.
Domo Arigato!
**Say 'Thanks' by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem as 'Accepted Solution'0 -
Thanks for the reply Godzilla -
The x-axis is going to be categories, not time. No trend is necessary.
0 -
Domo has these things called data label macros that might work for you here. Below is the link to their help section for data label macros.
http://wiki.domo.com/confluence/pages/viewpage.action?pageId=37454694
I'm assuming you're going to use a stacked bar chart to show the product % breakdown. If so, you can use the %_PERCENT_OF_CATEGORY macro which will automatically do this calculation for you. Once you've selectd the chart type and have added the x-axis, y-axis and the Series fields, go to Data Label Settings under chart properties and in the Text box, type in %_PERCENT_OF_CATEGORY in all caps and then tab out of the field and turn on your data labels by setting the Position and Justification fields. If you hover over that Text box, it will show you in a pop up what other macros are available.
This will do the calculation for you and will display it as the label on the chart and if you hover over the chart, it will still show your 'unit sales' values.
Domo Arigato!
**Say 'Thanks' by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem as 'Accepted Solution'1 -
Thanks Godzilla! That is a very cool function and will be very useful. But the nature of this problem is more in how to calculate the percentage (as opposed to just displaying it on the data label). As an example - comparing sales mix at 2 companies. The magnitudes of the 2 companies are vastly different, but converting the sales to percentages makes them comparable - if real values are used, Co 1 would be 2 inches tall and Co 2 would be .5 mm for example - hard to compare.
So how does one add a calc to say that 64% of Co 1's coffee sales are from ground coffee, but Co 2 has 79% of its coffee sales coming from ground coffee? Seems like it should just be sales/SUM(sales) or something along those lines - or in other words, what % is this row of the entire column (picturing it in table view, but the calc should be similar for any view or chart).
1 -
Update - I noticed today that there is a chart type "Percent of Total" in both the vertical bar and the horizontal bar groups. That does exactly what we are trying to accomplish - EXCEPT - we need it to have 2 series instead of just 1.
But again, if there was a way to calc the percent of total in Beast Mode, it would be easy to graph as many series as one desired.
1 -
We have a similar issue in creating a year over year variance percentage that can be summarized. Various customers, and again, massive shifts in scale, but it seems a top level summary percentage would be easier to get to than it is. I'll keep an eye on this thread and see if either of us find a solution.
0 -
I found a solution that may help. We had our volumes in 2 columns (it can be done with one as well), but it looks for the Fiscal Year (our LEFT statement) and assigns it the correct summed volume, and performs the calculation for var% with those statements. It works, and I can split it up as needed as well as include it in the summary number. I pulled it from the Sample Beast Mode documentation in the Help Center and modified it for our use case, You can find the information here under Variance % ((CY-PY)/PY)
Our formula:
((SUM( CASE WHEN (LEFT(`Fiscal Year-Month`,4)) = '2016' THEN `CY Claim Volume` ELSE 0 END)) - (SUM ( CASE WHEN (LEFT(`Fiscal Year-Month`,4)) = '2015' THEN `PY Claim Volume`ELSE 0 END))) / (NULLIF(SUM ( CASE WHEN (LEFT(`Fiscal Year-Month`,4)) = '2015' THEN `PY Claim Volume` ELSE 0 END), 0))
0 -
I'm having the same problem. There does not seem to be a way to go out one filter criteria here, or have Domo "ignore" a category filter on a % of total.
We'd like to be able to split a % of total into categories without the category filter changing our "denominator". The only way around this at the moment seems to be adding a static column to the dataset that is the denominator we want and creating the % of total Beast Mode using:
[ metric to calculate ] / MIN( [ denominator column ] ).4 -
How abouty something like this (using your example)
sum (Case... 'Coke'.... `unit sales` ) / sum(`unit sales`)
This should allow to filter out States.
BeastModes cannot use agregate data with non-agreagated data (as far as i understand), which is a royal pita.
1 -
0
-
I've got the same issue. In situations where I am just looking at a single column of info I use a pie chart (or other similar) that gives the % for category values. Same can be done as discussed in this thread via the data label macros.
The gap exists, at least as far as I have seen, when I'm trying to produce a table view.
In the attached screen shot, I have "Industry Product Groups" and need to know for each what % of the total they are so I can then compare the actual results to a goal "IPG Mix Goal". I heard at Domopalooza that totals for tables is coming in an enhancement, maybe that would include a solution for this as well (fingers crossed).
I'm trying to leave behind ALL MS Excel reports... this is an example where basic Excel Pivot Table features cannot be replaced in Domo. (in Excel this is "% of Column Total" in value field settings). Users are having to export to Excel from Domo to then produce the category comparisons. No bueno...
1 -
3
-
I second this issue. I'm relatively new to all this, but I'm struggling with summarizing data as well and a pivot table does what I need so easily. We really need this type of functionality!
Michael
1 -
Hi Everyone,
I have a related question/example. I have a data set where each row represents either an on-time shipment or a late shipment (data is a 1 for on-time, 0 for late) and the shipments fall into different categories (materials, components, etc) also noted on each row. There is also a date for each row so you can get to the weekly, monthly on-time-delivery %.
What I've been able to do:
- Use the 100% Stacked Bar chart and add the %_PERCENT_OF_CATEGORY to generate this green and red bar graph (see image) with a filter for 1 category.
- Generate a pie chart that sums up all the total YTD on-time vs. late shipments (see image).
What I'd like to do:
- Create a "Single Value" or "Filled" or "Progress Bar" chart that displays the % on-time data. Ideally a "Filled" gauge that has our target on-time-delivery % for a given time period. Do I need to use beastmode to make this possible?
Hope you all can help!
Cheers,
Michael
0 -
@DaniBoy this is still an open need for me. Have not been able to address how I described in my post earlier this year. The addition of subtotals to tables gives the ability to do a % of total, but the formatting is problematic - especially when you don't have multiple layers of sub-categories. Notice how the % of total is displayed as a seperate line. I need to display the percent of total as another column value. (See attached image)
Have not been able to accomplish with beast mode either.
1 -
Thanks @swagner,
I am going to try and track down an internal Beast Mode guru to have a look at this thread.
Stay tuned and regards,
1 -
Hey, I have also same issue. Partly found a solution, I have described it in this topic (https://dojo.domo.com/t5/Beast-Mode-ETL-Dataflow/Summing-up-filtred-values-based-on-criteria/m-p/27783#M3833).
But it's not a full solution so would be glad if you could find a way to calculate this thing ?
Cheers,
Rafal
0 -
Has anyone ever found the answer to this? I'd like to add a percent of total column to a table card as a beast mode.
1 -
Looks like a recent release allows this
1 -
link is not workint. anyone had any success in beast mode or dataflow.
0 -
Try finding a page called Windowing Functions in Beast Mode
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive