web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Real Life Dynamics User (RLDU) / SQL Scripts–Order Count–YTD...

SQL Scripts–Order Count–YTD By User

Ron Wilson Profile Picture Ron Wilson 6,010

Following up on my last script, SQL Scripts–Order Count–Previous Week By User, this script will show you the number of orders entered by user for the current year.

***Note that you will need to make sure the @doc_date is set to January 1st of the current year***

This script uses the following views:

Historical Sales Documents (tspvSalesDocuementHistory)

DECLARE @doc_date DATETIME

–Set @doc_date to January 1st of the current year–
SET @doc_date = ‘1/1/2010’

SELECT  created_by,
[Orders_Entered] = COUNT(*)
FROM    dbo.tspvSalesDocumentHistory
WHERE   Doc_Date >= @doc_date
AND Sales_Doc_Type = ‘order’
GROUP BY Created_By
ORDER BY orders_entered desc


This was originally posted here.

Comments

*This post is locked for comments