Calculating percentage in beast mode based on count
Hi, I have a dataset that looks like this:
Network Hour Date Avails A 1 1/1 2 A 2 1/2 4 B 1 1/1 6 B 2 1/2 8 C 1 1/1 10 C 2 1/2 12 C 2 1/2 12
The number of avails is the same for every row that has the same network, hour, and date. I need to write a beast mode that calculates the number of different rows that have the same network, hour, and date, and divide that count by the number of avails (not summed). So for the last two rows, the calculation would be 2 / 12. This needs to be in beast mode since the calculation will change depending on certain filters.
Thank you!
Best Answer
-
The numerator seems like it will be a straight count.
For the denominator, you want an average of the Avails fixed by your distinct grouping.
count(
Network
)/(AVG(Avails
) FIXED(ByNetwork
,Hour
,Date
))Please π‘/π/π/π this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
1
Answers
-
The numerator seems like it will be a straight count.
For the denominator, you want an average of the Avails fixed by your distinct grouping.
count(
Network
)/(AVG(Avails
) FIXED(ByNetwork
,Hour
,Date
))Please π‘/π/π/π this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
1 -
@DavidChurchman I think this is the right track, but it's not perfect.
The second to last row (A, 3, M) should be 0.33 since it's one row with that Network/Hour/Date combo and 3 avails.
0 -
Hard to say what's going on. It looks like you added a few rows to your example data. Could you post a screen grab of the raw example dataset, too?
Please π‘/π/π/π this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
0 -
@DavidChurchman sorry, I did add some rows just to test your formula since it wasn't working on my actual dataset.
I now realize that it's working as intended!! Sorry. I still don't know why it won't work with my dataset but I will look into it.
0 -
There are two A/3/M rows, so 2/3=.67 is correct, right?
Please π‘/π/π/π this post if you read it and found it helpful.
Please accept the answer if it solved your problem.
0 -
@DavidChurchman yes, that is correct, my apologies. Formula seems to work with the test dataset but not the actual so I will need to do some digging. Thank you!
1
Categories
- All Categories
- 1.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 295 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 97 SQL DataFlows
- 608 Datasets
- 2.1K Magic ETL
- 3.8K Visualize
- 2.4K Charting
- 709 Beast Mode
- 49 App Studio
- 39 Variables
- 667 Automate
- 170 Apps
- 446 APIs & Domo Developer
- 44 Workflows
- 7 DomoAI
- 33 Predict
- 13 Jupyter Workspaces
- 20 R & Python Tiles
- 391 Distribute
- 111 Domo Everywhere
- 274 Scheduled Reports
- 6 Software Integrations
- 115 Manage
- 112 Governance & Security
- Domo Community Gallery
- 31 Product Releases
- 9 Domo University
- 5.3K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 103 Community Announcements
- 4.8K Archive