i tried using MAX( DISTINCT CASE WHEN {appl...
# ask-stanley-ai
j
i tried using MAX( DISTINCT CASE WHEN {applyingtransaction.type} = 'Deposit Application' THEN ABS({applyingtransaction.amount}) ELSE 0 END ) to get the amount but instead of 2,740,000.00 it shows 7,540,000.00 why is it? by the way the record is the sublist i used Items Shipping Billing Accounting Relationships Communication Related Records System Information Custom GL Impact EFT Philippine Invoicing Payments Support Cases Transformations Date Type Number Status Amount 03/06/2026 Deposit Application DEPAAGI-00016193 500,000.00 03/06/2026 Deposit Application DEPAAGI-00016194 120,000.00 03/06/2026 Deposit Application DEPAAGI-00016195 2,100,000.00 03/06/2026 Deposit Application DEPAAGI-00016196 20,000.00 03/06/2026 Payment PVAGI-00004023 Deposited 10,000.00 Total 2,750,000.00
c
AI generated answer (using internal Slack threads):
The issue you're experiencing seems to be related to the way the MAX function is being used in your formula. The MAX function is an aggregation function that returns the maximum value in a set of values. In your case, it's returning the maximum value of the absolute amounts of the 'Deposit Application' transactions. However, the MAX function doesn't consider the individual transactions, but rather the entire set of transactions. This means that if there are other transactions in your data set that have an absolute amount greater than 2,740,000.00, the MAX function will return that higher value. In your case, it seems like there might be other transactions in your data set that are not 'Deposit Application' transactions but have an absolute amount greater than 2,740,000.00. Because your CASE statement returns 0 for these transactions, they are not affecting the sum, but they are affecting the MAX function. To solve this issue, you could try using a different approach to calculate the maximum absolute amount of the 'Deposit Application' transactions. For example, you could create a separate field in your data set that only contains the amounts of the 'Deposit Application' transactions and then use the MAX function on that field. Here's an example of how you could modify your formula:
Copy code
MAX(
   DISTINCT CASE
      WHEN {applyingtransaction.type} = 'Deposit Application'
      THEN ABS({applyingtransaction.amount})
      ELSE NULL
   END
)
In this modified formula, the CASE statement returns NULL for transactions that are not 'Deposit Application' transactions. The MAX function ignores NULL values, so it will only consider the amounts of the 'Deposit Application' transactions. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.860351622
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830749571
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827880859
Please provide your feedback on this answer.