Solution: Beast Mode & Pivot Table Aggregation Error
Use Case:
This chart uses a Beast Mode code for the Rows and Values in a pivot table chart. The results provide an error that is hard to understand without knowing what is causing the issue. Based on the results, we can also see the Cases is not calculating as expected.
The dataset only has 5 rows of data.
The Rows column in the pivot table is using a custom Beast Mode code.
CASE
WHENMaterial Number
= '6' THEN 'Cases'
ELSE 'Gallons'
END
The Values values column in the pivot table is also using a custom Beast Mode code. The CASE statement has multiple FIXED functions which causes the card to aggregate to the dimensions in the card and not the Row Group column as intended.
CASE
WHENMaterial Number
= '6'
THEN SUM(SUM(Cases
)) FIXED(FILTER DENYMaterial Number
)
ELSE SUM(SUM(Gallons
)) FIXED(FILTER DENYMaterial Number
)
END
The error message also had a hint at the same problem. It states that "Multiple results encountered for the same location". When we change the card type to a table card, it appears that the Gallons section is not aggregating up.
Adding the Material Number helps us see that the card is aggregating, and confirms the card is not using the Row Group column to aggregate. This causes the card to aggregate to the dimensions in the dataset, in this case the card is using the Material Number to aggregate to.
To correct the card and display the correct values we need to do 2 things.
- Correct the case statement logic to allow the FIXED function to use the custom Beast Mode as the default aggregation grouping. This is done by wrapping the case statement with the FIXED function instead of having multiple FIXED functions.
- Add the BY condition to the FIXED function to set the aggregation grouping. Now that the same custom grouping is added to the code that grouping, the card will default to this grouping when aggregating.
SUM(SUM(
CASE
WHENMaterial Number
= '6' THENCases
ELSEGallons
END)) FIXED(BY (CASE WHENMaterial Number
= '6' THEN 'Cases' ELSE 'Gallons' END) FILTER DENYMaterial Number
)
The new code now provides the proper results and aggregates on the custom Row Group column.
Comments
-
@abarrie23 did you try my suggestion on your post?
https://community-forums.domo.com/main/discussion/67998/domo-error-warning-multiple-errors-encountered-for-same-location-in-pivot-table-indicated-by#latest
0 -
Hello @abarrie23 ,
I think i see the issue here, it looks like you are mixing your aggregations in your case statement.
The THEN result appears to just be a non aggregated column, while the ELSE results in a Window function aggregation. When you mix aggregation results and non aggregation results you end up with multiple results which is what causes the issue.
To correct the issue, you will need to re-design your code to ensure that the results are all the same level. And it can be hard to say what will work without knowing the data structure, but if i had to guess, you might be able to add an aggregation to your THEN statement to get the aggregations to align. So depending on your datasetup, I would suggest trying a SUM or a MAX or MIN around your THEN statement.
CASE
when Term Length (Months) > 0 then MAX(Term Length (Months))
else
SUM(SUM(Term length (lookup)) FIXED (BY Document Number))
END1 -
Hi @JedP
I am encountering similar issue with one of the card. My Beast Mode Formula is same but only in one particular category view it gives me the same error. What I have realized is that the error came where the category value is Blank.
Just an example of the card where I am getting this error.
Month
2024-Dec
2024-Nov
2024-Oct
Job Family Group
Billable
Non Billable
Total
Billable
Non Billable
Total
Billable
Non Billable
Total
Family 1
55
6
61
45
14
59
55
6
61
Family 2
25
8
33
75
12
87
25
8
33
Family 3
90
17
107
10
3
13
90
17
107
****
****
****
****
****
****
****
****
****
Family 4
43
21
64
57
8
65
43
12
55
and my formula is
For Billable:
SUM
(
CASE
WHEN Billable Flag='Billable'
THEN Headcount - Actual
END
)For Non-Billable:
SUM ( CASE WHEN Billable Flag='Non-Billable' THEN Headcount - Actual END)
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
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 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