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.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 302 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 104 SQL DataFlows
- 635 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 760 Beast Mode
- 62 App Studio
- 42 Variables
- 700 Automate
- 182 Apps
- 457 APIs & Domo Developer
- 51 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 401 Distribute
- 116 Domo Everywhere
- 277 Scheduled Reports
- 8 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 111 Community Announcements
- 4.8K Archive