COUNT(DISTINCT creates An issue has occurred during processing. We... Error
I have created this first beastmode calc, and it seems to work just fine.
Case when `Total On Hand` - SUM(CASE when `Planned Shipment Date` < (CURDATE()+ 21) then `Outstanding Quantity` else 0 end) < 0 then `Item No` else 0 end
When I add a COUNT(DISTINCT to the end, it does not work and gives me the classic "An issue has occurred during processing. We..." error.
COUNT(DISTINCT Case when `Total On Hand` - SUM(CASE when `Planned Shipment Date` < (CURDATE()+ 21) then `Outstanding Quantity` else 0 end) < 0 then `Item No` else 0 end)
I would have expected it to work. Anybody have any suggestions?
Thanks
Best Answer
-
Learned MySQL and used that instead of trying to do it in BeastMode. Got the results I needed.
Thanks,
0
Answers
-
Try This one
COUNT(DISTINCT
Case when Sum(`Total On Hand`) - SUM(CASE when
`Planned Shipment Date` < (CURDATE()+ 21)
then `Outstanding Quantity` else 0 end) < 0 then `Item No` end)Domo Arigato!
**Say 'Thanks' by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem as 'Accepted Solution'1 -
try dropping the else 0 off of the end of the case statement
(edit) @Godiepi apparently I should have refreshed my browser before posting my suggestion
1 -
I copied that new statement in and it still gives me the "An issue has occurred during processing" error.
0 -
There might be some Nulls that are causing the calculation to break so try adjusting your calculation for those Nulls like
COUNT(DISTINCT
Case when Sum(`Total On Hand`) - SUM(CASE when
`Planned Shipment Date` < (CURDATE()+ 21)
then ifnull(`Outstanding Quantity`,0) else 0 end) < 0 then `Item No` end)Domo Arigato!
**Say 'Thanks' by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem as 'Accepted Solution'0 -
Is this beastmode being used for a summary number? Mind sharing the rest of the chart settings?
0 -
Not sure what you mean by summary, but my guess is that the answer is yes.
A little background. There are a list of items. Each item is assigned to a group.
If you look at the first picture attached, you can see that some items have a negative value in the Try 1 column. What I would like to do is get the number of items with a negative value to appear next to the Count of Parts column in the second picture. Once that is accomplished, we can see how many items are in each group and then how many have a negative value based on the criteria from the earlier posts.
As shown earlier, when I attempt to count the number of negative items via Count(Distincts and Case whens, it errors out.
Let me know what other info you might need.
Thanks for all of the help so far.
0 -
oh that looks a little different from the prior description of what you are trying to do, but focusing for now in the second picture you can have a table card with 3 columns:
1st column = Group
2nd column = Beastmode, lets call it "Count of Negatives"
code would be as simple as
ifnull(Count( Case when `Try 1` < 0 then `Try 1` end),0)
The reason why I am not doing a Count Distinct here is that if there are 2 or more negatives with the same value it would counted once
3rd column = `Try 1` , setting the aggregation to Count and naming the field "Count of Parts"
@ST_-Superman-_ any ideas ?
Domo Arigato!
**Say 'Thanks' by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem as 'Accepted Solution'0 -
@user02631 I think this would be easier if we could get a sample of the data. Would you be able to share a sample of your dataset? Ideally, it would need to contain 2 or 3 groups with several of the items from each group. Feel free to anonymize the names of the items or groups, but without understanding the dataset structure, I think it will be very unlikely that we will get you the correct solution.
0 -
Learned MySQL and used that instead of trying to do it in BeastMode. Got the results I needed.
Thanks,
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 302 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 104 SQL DataFlows
- 633 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 760 Beast Mode
- 62 App Studio
- 42 Variables
- 699 Automate
- 181 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