Showing Quarters Dynamically

  • Hi,

    At present am showing quarters from 2015-Q1 to Q4 , it should be like that, because report must show data for last 4 quarters only.

    Whenever i got data for "2016-Q1" then automatically report should change and display data for "2016-Q1" - "2015-Q4" - "2015-Q3" - "2015-Q2", it should be based on current quarter. same for upcoming quarters also.

    Is it possible??

    again this is for reporting purpose only... there is 4 sets of query and using UNION

    and also in the logic its hard coded as:

    '2015 01' AS Qtr from Table WHERE (YYYYMM = 201503)

    UNION

    '2015 02' AS Qtr from Table WHERE (YYYYMM = 201506)

    UNION

    '2015 03' AS Qtr from Table WHERE (YYYYMM = 201509)

    UNION

    '2015 04' AS Qtr from Table WHERE (YYYYMM = 201512).

    please let me know if anyone need more details.

  • Duplicate thread. Direct any esponses to http://www.sqlservercentral.com/Forums/Topic1766578-3412-1.aspx

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply