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.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 292 Workbench
- 4 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 95 SQL DataFlows
- 602 Datasets
- 2.1K Magic ETL
- 3.7K Visualize
- 2.4K Charting
- 693 Beast Mode
- 43 App Studio
- 39 Variables
- 658 Automate
- 170 Apps
- 441 APIs & Domo Developer
- 42 Workflows
- 5 DomoAI
- 32 Predict
- 12 Jupyter Workspaces
- 20 R & Python Tiles
- 386 Distribute
- 111 Domo Everywhere
- 269 Scheduled Reports
- 6 Software Integrations
- 113 Manage
- 110 Governance & Security
- 8 Domo University
- 30 Product Releases
- Community Forums
- 39 Getting Started
- 29 Community Member Introductions
- 98 Community Announcements
- Domo Community Gallery
- 4.8K Archive