How can I fix this Beast Mode Window Function to display the proper value in the total row?
I have the following table that is using window functions in beast mode to calculate pipeline coverage.
I have these window functions for calculating the visible visible columns:
Pipeline/AOP
SUM(CASE WHEN LEFT(`Stage`, 1) != '7' THEN `Pipeline` END) / MIN(`AOP`) OVER (PARTITION BY `Selling Lane`)
Late Stage/AOP
SUM(CASE WHEN LEFT(`Stage`, 1) IN ('3','4','5','6') THEN `Pipeline` END) / MIN(`AOP`) OVER (PARTITION BY `Selling Lane`)
Each Selling Lane has a specific AOP and there are multiple records for each selling lane.
The issue is the total row is showing the sum for each of the Selling Lanes' coverages instead of the total aggregation. I'm assuming this is because I have the partition by clause included in there, which is needed to calculate it for each selling lane. Is there a way that I can get the total row to show the aggregate overall instead of the sum for each of the selling lanes?
Best Answers
-
The total row adds everything after beast modes have been applied. You’ll need to stack your data in an ETL using an append with your data set grouped and summed and call the rows TOTAL. Then you can use the beast mode to calculate your data for each lane and the total
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
I don't quite understand what you're trying to accomplish, but this is syntactically incorrect (for analyzer) ... it's fine for standard SQL. But this window function MIN(AOP) will not aggregate as expected.
SUM(CASE WHEN LEFT(`Stage`, 1) IN ('3','4','5','6') THEN `Pipeline` END) / MIN(`AOP`) OVER (PARTITION BY `Selling Lane`)
Window functions in Analyzer must always include two aggregations b/c the windowing happens AFTER the initial GROUP BY clause is applied.
In the below example, by taking SUM(AOP) for each row of your displayed axis, and then taking the MIN of each SUM() you're finding the minimum aggregated AOP across all your rows.
If you did it the other way around SUM(MIN(AOP) you'd find the minimum AOP for each group and then sum the MIN(AOP) across all groups.
SUM(CASE WHEN LEFT(`Stage`, 1) IN ('3','4','5','6') THEN `Pipeline` END) / MIN(SUM(`AOP`)) OVER (PARTITION BY `Selling Lane`)
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"1
Answers
-
@jaeW_at_Onyx Are you able to answer this?
0 -
Did you try this?
SUM(CASE WHEN LEFT(`Stage`, 1) != '7' THEN `Pipeline` END) OVER () / MIN(`AOP`) OVER(PARTITION BY `SF Selling Lane`)
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
Thanks for your response! Unfortunately that seems not to have worked. Doing that breaks the aggregation by selling lane and shows the overall aggregation * number of records in the total row.
0 -
The total row adds everything after beast modes have been applied. You’ll need to stack your data in an ETL using an append with your data set grouped and summed and call the rows TOTAL. Then you can use the beast mode to calculate your data for each lane and the total
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
I don't quite understand what you're trying to accomplish, but this is syntactically incorrect (for analyzer) ... it's fine for standard SQL. But this window function MIN(AOP) will not aggregate as expected.
SUM(CASE WHEN LEFT(`Stage`, 1) IN ('3','4','5','6') THEN `Pipeline` END) / MIN(`AOP`) OVER (PARTITION BY `Selling Lane`)
Window functions in Analyzer must always include two aggregations b/c the windowing happens AFTER the initial GROUP BY clause is applied.
In the below example, by taking SUM(AOP) for each row of your displayed axis, and then taking the MIN of each SUM() you're finding the minimum aggregated AOP across all your rows.
If you did it the other way around SUM(MIN(AOP) you'd find the minimum AOP for each group and then sum the MIN(AOP) across all groups.
SUM(CASE WHEN LEFT(`Stage`, 1) IN ('3','4','5','6') THEN `Pipeline` END) / MIN(SUM(`AOP`)) OVER (PARTITION BY `Selling Lane`)
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 101 SQL DataFlows
- 622 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 748 Beast Mode
- 59 App Studio
- 41 Variables
- 686 Automate
- 176 Apps
- 453 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 396 Distribute
- 113 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 125 Manage
- 122 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 109 Community Announcements
- 4.8K Archive