find % of row value vs. column total
Comments
-
I think I have the exact same question. See screenshot below for question. I'd like a column that would be 325,965 / 959,627 or 34.0% and so on for each subsequent row.
0 -
Hello @mwade and @kivlind,
Sadly in beastmode we cannot calculate this. We will need to use a dataflow to accomplish this.
Using a Magic ETL:
In ETL we first want to replicate our card.- Add an input dataset and select your dataset
- If your card has any filters you want to apply them next, using "Filter Rows"
- We will now use "Add Constants" to add a constant text column of 1
- Now using group by we are going to group by "1" and aggregate our value column
- If you have multiple Value columns you want to aggregate all of them in this step.
- You should now have a column with a single value in it.
- This is your total for that column
- You now will want to join this to our original data.From the orignal data we are going to use "Add Constants" and add a constant text column with a value of 1
- We now can join our input dataset to our single value.
- Add a Select Columns and remove your columns 1 and 1_1
- Now you can add your output.
You can now create a card from this Magic ETL. You will now have a column that contains a total value.
You can now create a beastmode to find the percent.SUM(`value_column`) / MAX(`total of value`)
This should give you your percentage.
**Say “Thanks" by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"2 -
Any chance this can get added to the development plan? We need to calculate this % to Total dynamically, based on what the group by is on the card.
2 -
A dynamic solution at card level can be to use a window function. It's not currently documented and may be subject to change, but I've found it to work for basic aggregates: SUM, AVG, MIN, MAX
In your case, you could get the grand total:
SUM(SUM(value)) OVER ()
And for % Total:
SUM(value) / SUM(SUM(value)) OVER ()
Jacob Folsom
**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"5 -
Hi,
Can you explain what OVER() is? I don't think it is found within the Beast mode function list.
Thanks.
0 -
OVER() indicates the function is not a plain aggregation, but an analytic function. It's also called a window function because you can specify a window of rows to evaluate. In the example above, OVER() is empty which indicates that the SUM is to be across all-time and all groupings, thus returning the grand total.
Here is some documentation for one database vendor...which explains how it generally works.
Jacob Folsom
**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"2 -
What about by count and subtotal?
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive