Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

Finding Duplicate values

Accepted answer
25
Views
3
Comments

Hi all… Apologies in advance if this question is entered into the wrong forum. If so, please let me know where it would be best to ask this question. I am attempting to write an expression filter.

Essentially, what I would like to find are duplicate dollar amounts found in a variety of transactions. For example; A customer attempts a transaction for $512.44 using whatever credit card number they have.

However, the transaction may be declined multiple times before it gets approved. However, it may be they then attempt to use a different credit card number to get that amount of $512.44 approved.

I would like to write an expression filter that shows me duplicate transactions (2 or more) of a certain dollar amount like $512.44. I have attempted the following statement below but this does not appear to work:

case when COUNT(DISTINCT transaction_amount) >= 2 then 'suspicious transaction' else 'normal transaction' END

Any and all feedback would be greatly appreciated. Thank you all so much!

Best Answer

  • Sushant Mishra
    Sushant Mishra Rank 5 - Community Champion
    edited Sep 25, 2025 4:08AM Answer ✓

    You could try creating a measure such as:
    COUNT(transaction_id BY transaction_amount)

    Then use it within a filter or a CASE expression like this:
    CASE WHEN COUNT (transaction_id BY transaction_amount) >=2

    THEN

    'suspicious transactions'

    ELSE

    'normal transaction'

    END

    This approach should help in flagging amounts that appear multiple times. Of course, the exact implementation may vary depending on the structure of your dataset and how your transactions are modeled.

Answers

  • User_DARJB
    User_DARJB Rank 1 - Community Starter

    Sushant you are genius, thank you so much! I was able to implement this with no issue, the only thing I had to change was taking out "COUNT" in front of "CASE WHEN" when I was creating the expression. I appreciate your help!

  • Sushant Mishra
    Sushant Mishra Rank 5 - Community Champion

    Happy to Help.