How to calculate average using SUM(DISTINCT 'field name') / COUNT(DISTINCT 'field name')
Trying to get average of the SUM(DISTINCT 'Days Excavating') / COUNT(DISTINCT 'Days Excavating'). Both field types are whole numbers. This calculation always retuns the value for SUM(DISTINCT 'Days Excavating'). Beast Mode does not run the COUNT(DISTINCT 'Days Excavating'). I have used parenthesis around both functions and the whole calculation. No change. For example if the SUM(DISTINCT 'Days Excavating') = 22 and the COUNT(DISTINCT 'Days Excavating') = 11. The average equals 2.
Each function works seperately as the only function in other calculated fields. Any thoughts how to make this work?
Best Answer
-
I figured a solution for this. Just like in SQL, you use the OVER clause to get other window functions to run. So I added an OVER clause to the Count(Distinct 'field name') OVER (order by 'field name 1' asc) to get my solution. It works as expected.
Hope this helps others.
0
Answers
-
I figured a solution for this. Just like in SQL, you use the OVER clause to get other window functions to run. So I added an OVER clause to the Count(Distinct 'field name') OVER (order by 'field name 1' asc) to get my solution. It works as expected.
Hope this helps others.
0
Categories
- All Categories
- 1.4K Product Ideas
- 1.4K Ideas Exchange
- 1.4K Connect
- 1.2K Connectors
- 284 Workbench
- 4 Cloud Amplifier
- 4 Federated
- 2.9K Transform
- 88 SQL DataFlows
- 554 Datasets
- 2.2K Magic ETL
- 3.3K Visualize
- 2.3K Charting
- 564 Beast Mode
- 9 App Studio
- 27 Variables
- 577 Automate
- 140 Apps
- 414 APIs & Domo Developer
- 22 Workflows
- 1 DomoAI
- 28 Predict
- 12 Jupyter Workspaces
- 16 R & Python Tiles
- 350 Distribute
- 90 Domo Everywhere
- 258 Scheduled Reports
- 2 Software Integrations
- 91 Manage
- 88 Governance & Security
- 9 Product Release Questions
- Community Forums
- 42 Getting Started
- 28 Community Member Introductions
- 85 Community Announcements
- 4.8K Archive