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
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 657 Datasets
- 115 SQL DataFlows
- 2.2K Magic ETL
- 815 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 81 App Studio
- 45 Variables
- 775 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 81 Workflows
- 23 Code Engine
- 40 AI and Machine Learning
- 20 AI Chat
- 1 AI Playground
- 1 AI Projects and Models
- 18 Jupyter Workspaces
- 410 Distribute
- 120 Domo Everywhere
- 280 Scheduled Reports
- 10 Software Integrations
- 144 Manage
- 140 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 114 Community Announcements
- 4.8K Archive