Skip to Content
author's profile photo Former Member
Former Member

YTD Sales Figures

I would like to get a list of customers by salesperson including their YTD sales. Since I want address, city, state, zip and some other fields in the output, I am not able to use the sales analysis report. After creating this query, I am going to export the results to an Excel spreadsheet. I have created this query but do not know how to get the YTD sales figure for this business partner. Is there an easy way to get this number?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on May 31, 2013 at 12:29 AM

    Hi Caroline Stewart

    Try This

    SELECT T0.CardCode, T0.CardName, T3.SlpName, Sum(IsNull(T2.LineTotal,0)) 'YTD Total'

    FROM OCRD T0

    Left JOIN OINV T1 ON T0.CardCode = T1.CardCode

    Left JOIN INV1 T2 ON T1.DocEntry = T2.DocEntry

    Left JOIN OSLP T3 ON T0.SlpCode = T3.SlpCode

    WHERE T0.CardType ='C'

    And DateDiff(YY,T1.DocDate,GetDate()) = 0

    GROUP BY T0.CardCode, T0.CardName, T3.SlpName

    HAVING Sum(IsNull(T2.LineTotal,0))>0

    Regards

    Kennedy

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 31, 2013 at 12:16 AM

    Hi Caroline Stewart,

    Please post query here to add YTD sales figure.

    Thanks & Regards,

    Nagarajan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 31, 2013 at 01:43 PM

    Here's my query so far:

    SELECT T0.[CardCode], T0.[CardName], T1.[Street], T1.[City], T1.[State], T1.[ZipCode], T2.[SlpName], T3.[descript]

    FROM OCRD T0

    INNER JOIN CRD1 T1 ON T0.CardCode = T1.CardCode

    INNER JOIN OSLP T2 ON T0.SlpCode = T2.SlpCode

    INNER JOIN OTER T3 ON T0.Territory = T3.territryID

    WHERE T0.[CardType] = 'C' AND T1.[AdresType] = 'S' AND T2.[SlpName] =[%1]

    Thank you

    Caroline

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 31, 2013 at 06:08 PM

    Hello Kennedy,

    I was able to insert part of your query into mine and make it work. Thanks! However, my fiscal year is August 1 to July 31 and I am interested in the YTD totals being in that time frame. Can you tell me how to modify it?

    Thank you.

    Caroline

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.