Percentage of values in a column
Hello,
In the beast mode how should I get the percentage of column totals like below, 50 hours worked is the 12 percent of the total hours (410). I need to create a column like % Hours so that I can make further calculated fields based upon that.
Provider | Hours worked | Total Tickets | % Hours | % Tickets |
---|---|---|---|---|
John | 50 | 20 | 0.12 | 0.10 |
David | 60 | 30 | 0.15 | 0.15 |
Mark | 100 | 50 | 0.24 | 0.25 |
Antony | 200 | 100 | 0.49 | 0.50 |
Best Answer
-
@agolla2 you can use a window function to achieve this.
SUM(SUM(value)) over ()
Then you can use that as an input in another beast mode (you could also combine these all into 1 beast mode). Best to separate it out if you will be using it in other calculations.
SUM(value)/total_hours
Which can then be used to generate your desired output.
A couple things to keep in mind. This window function calculates the total over all data. If you need to split by group, you'll need to make use of the PARTITION BY argument.
You can use the same approach to calculate % of tickets.
David Cunningham
** Was this post helpful? Click Agree 😀, Like 👍️, or Awesome ❤️ below **
** Did this solve your problem? Accept it as a solution! ✔️**1
Answers
-
@agolla2 you can use a window function to achieve this.
SUM(SUM(value)) over ()
Then you can use that as an input in another beast mode (you could also combine these all into 1 beast mode). Best to separate it out if you will be using it in other calculations.
SUM(value)/total_hours
Which can then be used to generate your desired output.
A couple things to keep in mind. This window function calculates the total over all data. If you need to split by group, you'll need to make use of the PARTITION BY argument.
You can use the same approach to calculate % of tickets.
David Cunningham
** Was this post helpful? Click Agree 😀, Like 👍️, or Awesome ❤️ below **
** Did this solve your problem? Accept it as a solution! ✔️**1 -
Hey David! Thanks for sharing it worked for me.
But I'm trying to use these beast mode calculations to do a weighted average like we do in excel.
Example of single value weighted average for 2 columns: "=SUMPRODUCT(F48:F70,E48:E70)/SUM(E48:E70)"
My question is can we still try to do the weighted average even after using the window function calculation we did. Because we might face an aggregation issue as in, we cannot refer an already referred beast mode calculation. I hope you got my question.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
- 754 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 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