Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Opportunity Close - only pull the latest date

$
0
0

I am writing an SSRS report using Opportunity Close entity, displaying Actual End date.  When an Opportunity has been closed, reopened and closed a second time, the report shows both rows.  Is there a way to only show the latest date?

Here is the query:

Declare @Year int;
Set @Year = 2013

SELECT
FilteredOpportunityclose.owneridname,
FilteredSynact_Loan.synact_loantypename,
FilteredSynact_Loan.synact_commitment,
FilteredOpportunity.customeridname,
FilteredSynact_Loan.statuscodename,
FilteredOpportunityclose.description,
FilteredOpportunityclose.actualend


FROM FilteredOpportunity
INNER JOIN FilteredOpportunityClose ON FilteredOpportunity.opportunityid = FilteredOpportunityClose.opportunityid
INNER JOIN FilteredSystemUser ON FilteredSystemUser.fullname = FilteredOpportunity.owneridname
INNER JOIN FilteredSynact_Loan ON FilteredSynact_Loan.synact_opportunityid = FilteredOpportunity.opportunityid


WHERE

(FilteredOpportunity.statuscode = '4' OR
FilteredOpportunity.statuscode = '5' OR
FilteredOpportunity.statuscode = '200000' OR
FilteredOpportunity.statuscode = '200001' OR
FilteredOpportunity.statuscode = '200002') AND
FilteredOpportunityclose.actualend >= '1/1/' + CAST(@Year AS NVARCHAR) AND
FilteredOpportunityclose.actualend <= '12/31/' + CAST(@Year AS NVARCHAR)

ORDER BY
FilteredOpportunityclose.owneridname,
FilteredOpportunityclose.actualend

Any help is appreciated!


Ken Compter


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>