0

I have two queries and I somehow need to get them to work together...

SELECT Owner.Name Salesperson, RecordType.Name, COUNT(Id) FROM Opportunity WHERE CALENDAR_MONTH(CreatedDate) = 1 AND CreatedDate = THIS_YEAR GROUP BY Owner.Name, RecordType.Name ORDER BY Owner.Name ASC

and

SELECT Owner.Name, COUNT_DISTINCT(Id), COUNT(ConvertedDate) FROM Lead WHERE CALENDAR_MONTH(CreatedDate) = 1 AND CreatedDate = THIS_YEAR GROUP BY Owner.Name

What I am trying to achieve is get a list of all the leads that came in for the month with each person and then get a count of each of the Opportunities Types that they created that same month. Both reports run fine by themselves, but marrying them together to get on the same report is proving a bit tricky.

If it makes any difference, I will be creating the report in Conga Composer.

0

Unlike SQL, Salesforce does not support Union clause to join 2 different resultset from 2 tables.

You can create separate object, populate the data based on above queries and then finally use that object for mapping with conga reports

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.