Column Total Greater than Sum of ROWS
Why is "# Houses" Column Total Greater than Sum of ROWS on "Closed Punch Tickets by Plumber" Card
BEAST MODE for "# of Houses":
COUNT(DISTINCT(CASE WHEN JT158_WTParent
= 'Y' AND HdrParentItemCode
= 'ZPUNCH' THEN SalesOrderNo
END))
Best Answer
-
Likely, you have multiple records for the same
SalesOrderNo
value so when it's doing it in aggregate it's doing the distinct count across all superintendents instead of adding each individual distinct count per individual superintendent.**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1
Answers
-
Likely, you have multiple records for the same
SalesOrderNo
value so when it's doing it in aggregate it's doing the distinct count across all superintendents instead of adding each individual distinct count per individual superintendent.**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1 -
I too think your DISTINCT is probably the reason. If you are trying to count, I would create the CASE statement to be COUNT(CASE WHEN {conditions met} THEN 1 ELSE 0 END)….without DISTINCT.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
This does not make sense. How can ROW Totals for Michael Reed on Closed Punch Tickets by Super Card match Total of Closed Tickets by Plumber then. Both Cards are pulling from exact same data set, filters are exactly the same on both Cards but Closed Tickets by Plumber Card is just showing what Plumbers have same Superintendent for those Houses?
0 -
If I count without Distinct then my number is incorrect
0 -
@jtrollinger Total rows calculate based off of values in the source dataset, not the aggregated values in the table rows. In this case it means that there were 47 unique values in the
SalesOrderNo
field, some which have records for multiple Assigned Plumbers.2 -
Michelle is correct. In fact, I am staring at one of my own cards where the grand total shown is completely wrong because of this reason.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
As @MichelleH explained this is the default behavior and often what you want, specially as this will be responsive and dynamic to any level of aggregation you need to have in place.
If for some reason you do not want the Total Rollup to be the COUNT DISTINCT for the full data table, then you'll need to change your aggregation to be a Beast Mode, using FIXED at the level displayed on your card and then indicate to then SUM those at any higher level (which means you need to know what the level of granularity will be at which you want the count UNIQUE to happen). Something like:
SUM(COUNT(DISTINCT (CASE WHEN JT158_WTParent = 'Y' AND HdrParentItemCode = 'ZPUNCH' THEN SalesOrderNo END)) FIXED (BY `Assigned Plumber`))
Basically asking the system to tell you the number of unique houses each plumber visited and then add those up. Or another option is to do a COUNT UNIQUE on the concatenation of the Plumber + SalesOrderNo:
COUNT(DISTINCT(CASE WHEN JT158_WTParent = 'Y' AND HdrParentItemCode = 'ZPUNCH' THEN CONCAT(`Assigned Plumber`, SalesOrderNo) END))
But again it all depends on what the data is meant to show and COUNT DISTINCT the way you have it is most likely the accurate representation the business might be looking at (they just need to understand that depending on the level of granularity the same order might appear repeated multiple times)
0
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
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 755 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive