Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

Fiscal Dates in SSRS Report - Starting to Ending Date

Posted on by

Hello All,

I am trying to help my IT group with getting a SSRS report to work properly. We are trying to get the functionality in the smartlist where the transaction date is between Beginning of Period and End Period to work in a SSRS report. 

Using this code, stole from SQL queries for fiscal years and periods in Dynamics GP by VICTORIA YUDIN. I tried to see if this could be starting point, but our IT group hasn't had any luck.

SELECT    D.PERIODID Period_Number,    D.PERNAME Period_Name,    D.PERIODDT Starting_Date,    D.PERDENDT Ending_Date,    D.YEAR1 Fiscal_Year FROM SY40100 D INNER JOIN    SY40101 H    ON H.YEAR1 = D.YEAR1 WHERE    D.FORIGIN = 1 AND D.PERIODID <> 0    and GETDATE() between H.FSTFSCDY and H.LSTFSCDY ORDER BY D.PERIODID

This is the result.

Period_Number Starting_Date Ending_Date Fiscal_Year
Period 1 2020-04-01 2020-05-03 2021
Period 2 2020-05-04 2020-05-31 2021
Period 3 2020-06-01 2020-06-28 2021
Period 4 2020-06-29 2020-08-02 2021
Period 5 2020-08-03 2020-08-30 2021
Period 6 2020-08-31 2020-09-27 2021
Period 7 2020-09-28 2020-11-01 2021
Period 8 2020-11-02 2020-11-29 2021
Period 9 2020-11-30 2020-12-27 2021
Period 10 2020-12-28 2021-01-31 2021
Period 11 2021-02-01 2021-28-28 2021
Period 12 2021-03-01 2021-03-31 2021


What I want to do is to get the start and ending date to be pulled into the parameter of the SSRS based on the server date. For example today is 2020-07-07. The Starting date would be 2020-06-29 and the ending date would be 2020-08-02.

I am a complete novice on SQL and my Google Fu hasn't found anything that has pointed me in the right direction.

Any help would be much appreciated and Thanks in advance.

Categories:
  • bgajjar Profile Picture
    bgajjar 150 on at
    RE: Fiscal Dates in SSRS Report - Starting to Ending Date

    Hi There, 

    In your query just change highlighted part in where condition, this will return one row as per current date

    SELECT D.SERIES, D.PERIODID Period_Number, D.PERNAME Period_Name, D.PERIODDT Starting_Date, D.PERDENDT Ending_Date, D.YEAR1 Fiscal_Year
    FROM SY40100 D INNER JOIN SY40101 H ON H.YEAR1 = D.YEAR1
    WHERE D.FORIGIN = 1 AND D.PERIODID <> 0 and GETDATE() between D.PERIODDT and D.PERDENDT
    ORDER BY D.PERIODID

    I guess this is what you are looking. if not, if you can explain in detail. i may help you.

    Thanks

    Bharat

  • RE: Fiscal Dates in SSRS Report - Starting to Ending Date

    Thank you for using Community Forums. My name is Becky and I will assist you.

    Can you tell me if your are trying to create a custom SSRS report or if you are trying to modify a canned SSRS report?

    If it is a customer report,  you would want to post this in the SSRS reports forums, or open a case with the SSRS Microsoft Team,

    as they would be the best resource for assisting with formatting of reports being built from the ground up.

    If this is one of our reports, we need to know which report it is, and we could give adding the parameter a try.

    Becky

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans