Avatar of Annette Wilson, MSIS
Annette Wilson, MSIS
Flag for United States of America asked on

SQL Reporting - Calculate Week number of Year

Hi!

I am working on an sql report that should show the scheduled count date for each part.

1. This gives me the next count date in days:  DATEDIFF(day, C.LAST_COUNT_DATE, GETDATE()) - C.COUNT_FREQ

2. I have another table that will give me the actual date that the part was counted for the current year.

3.  If a part is scheduled to be counted every four years, I need to be able to display the  dates  that it was counted then the next three scheduled count dates.

The schedule should look like:

Part_ID                 ABC_CODE        Count Date            Next Count Date              NextCountDate         NextCountDate

888*FRP*66*U                    D                   3/20/2015                  3/20/2019                          3/20/2023                  3/20/2027
                                                                           C                            X                                               X                                   X



777*568*22                        A                    1/2/2015                    6/2/2015                            1/2/2016                      6/2/2016
                                                                          C                                 X                                         X                                     X

Open in new window



The 'X'  and 'C'   stand for Counted and not yet counted.  If the item has been counted according to the appropriate count frequency, I want to show  a 'C'.
SSRSMicrosoft SQL Server 2005

Avatar of undefined
Last Comment
Annette Wilson, MSIS

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Mark Ely

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Vitor Montalvão

technette, do you still need help with this question?
Annette Wilson, MSIS

ASKER
I need help in a different way.  I will post another question.  Thank you Vitor.
Annette Wilson, MSIS

ASKER
Thank you.  This was a quick and workable solution.
Your help has saved me hundreds of hours of internet surfing.
fblack61