Categories
- All Categories
- 15 Oracle Analytics Sharing Center
- 16 Oracle Analytics Lounge
- 215 Oracle Analytics News
- 43 Oracle Analytics Videos
- 15.7K Oracle Analytics Forums
- 6.1K Oracle Analytics Idea Labs
- Oracle Analytics User Groups
- 79 Oracle Analytics Trainings
- 15 Oracle Analytics Data Visualizations Challenge
- Find Partners
- For Partners
Getting a count of repeating rows into a report column

I have a request for a report from a client that wishes to show some Sales Agents activity -- their sales to all addresses, and then their sales to repeat addresses.
This is to gauge Sales Agents that have mutiple customers at the same addresses.
If the data looked like this:
SalesAgent1
999 Lion St
999 Lion St
999 Lion St
555 Tiger St
555 Tiger St
777 Bear St
222 Fox St
444 Cat St
SalesAgent2
888 Roger St
888 Roger St
333 Black St
111 White St
666 Blue St
They want the report to show something like below:
Sales Agent | Count of UNIQUE Addresses | Count of Repeat Addresses |
---|---|---|
SalesAgent1 | 5 | 2 |
SalesAgent2 | 4 | 1 |
The 'Count of UNIQUE Addresses' column will just give a count of all of the addresses (not a count of customers)
I know how to get the Count of UNIQUE Addresses:
COUNT(DISTINCT "Customer"."Address")
The 'Count of Repeat Addresses' column needs to show a count of the addresses that have multiple customers -- so in other words, just a count of addresses that repeated.
The 'Count of Repeat Addresses' column is the one giving me problems. I feel like this should be a simple thing but I am making it too complex in my mind. I just cannot figure out how to do this part.
Is this even possible? If so, does anyone have any ideas as to how to achieve this?
Any help is greatly appreciated.
Answers
-
Something similar to SUM(CASE WHEN COUNT(address BY address,sales agent) > 1 THEN 1 ELSE 0 END BY sales agent) should do the trick.
Sent from my iPhone
0 -
That did it! THANK YOU!
Here is how it ended up looking (in case you are interested)
SUM(CASE WHEN COUNT(
CONCAT(UPPER("Location"."Address1"), UPPER("Location"."Address2")) BY
CONCAT(UPPER("Location"."Address1"), UPPER("Location"."Address2")), "Agent"."Agent ID"
) > 1
THEN 1 ELSE 0 END BY
"Agent"."Agent ID"
)
0