How to get an avg in the grand total of a column with a BM with sum?
Hi, Im trying to use this BM
CASE
WHEN MONTH(Cycle
)='10' THEN
(sum($ New Annual Salary(in USD)
)/ sum($ Annual Salary(in USD)
))-1 ELSE sum($ New Annual Salary(custom)(in USD)
)/ sum($ Annual Salary(in USD)
)-1 end
and its sucessful but in the Grand Total I requiered an average not a sum, and usually I can use the agregation option per column but in this especific one, I can´t, if I skip the sum in the calculation, the result is incorrect the only thing I need to get an average is in the Grand Total
Best Answer
-
Thank u
0
Answers
-
@Pam1324 Since the only difference between the calculations for Month 10 calculation and all other months is the numerator, the grand total will work more cleanly with the case statement inside the first sum like below. Aggregations work best when they are outside of the case statement, rather than inside them.
sum(case when month(`cycle`) = '10' then `$ new Annual Salary(in USD)` else `$ New Annual Salary(custom)(in USD)` end) / sum(`$ Annual Salary(in USD)`) - 1
1 -
Thank u
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive