Fiscal Column Year - Month / Values Result

  • Good afternoon

    I would like a script that can generate the following query, but that has the possibility to see also see the previous years with their months. It is more like a fiscal period, which contains years and months.

    Thanks

  • angelreynosog - Tuesday, January 22, 2019 2:23 PM

    Good afternoon

    I would like a script that can generate the following query, but that has the possibility to see also see the previous years with their months. It is more like a fiscal period, which contains years and months.

    Thanks

    This is a requirement, not a question. Which part of all of this is proving difficult for you?
    Your results look like a cross tab type of report. This type of reporting is usually handled better by the presentation tool (SSRS, Excel etc) than in T-SQL.
    If you do not provide sample DDL and INSERT scripts , how do you expect anyone to offer pertinent assistance?

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Phil Parkin - Tuesday, January 22, 2019 3:32 PM

    angelreynosog - Tuesday, January 22, 2019 2:23 PM

    Good afternoon

    I would like a script that can generate the following query, but that has the possibility to see also see the previous years with their months. It is more like a fiscal period, which contains years and months.

    Thanks

    This is a requirement, not a question. Which part of all of this is proving difficult for you?
    Your results look like a cross tab type of report. This type of reporting is usually handled better by the presentation tool (SSRS, Excel etc) than in T-SQL.
    If you do not provide sample DDL and INSERT scripts , how do you expect anyone to offer pertinent assistance?

    And quit double posting.
    https://www.sqlservercentral.com/Forums/2017374/Year-By-Months-Columns

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden - Tuesday, January 22, 2019 9:30 PM

    Phil Parkin - Tuesday, January 22, 2019 3:32 PM

    angelreynosog - Tuesday, January 22, 2019 2:23 PM

    Good afternoon

    I would like a script that can generate the following query, but that has the possibility to see also see the previous years with their months. It is more like a fiscal period, which contains years and months.

    Thanks

    This is a requirement, not a question. Which part of all of this is proving difficult for you?
    Your results look like a cross tab type of report. This type of reporting is usually handled better by the presentation tool (SSRS, Excel etc) than in T-SQL.
    If you do not provide sample DDL and INSERT scripts , how do you expect anyone to offer pertinent assistance?

    And quit double posting.
    https://www.sqlservercentral.com/Forums/2017374/Year-By-Months-Columns

    Thanks!!! The solution Dynamics Pivot!

  • Jeff Moden - Tuesday, January 22, 2019 9:30 PM

    Phil Parkin - Tuesday, January 22, 2019 3:32 PM

    angelreynosog - Tuesday, January 22, 2019 2:23 PM

    Good afternoon

    I would like a script that can generate the following query, but that has the possibility to see also see the previous years with their months. It is more like a fiscal period, which contains years and months.

    Thanks

    This is a requirement, not a question. Which part of all of this is proving difficult for you?
    Your results look like a cross tab type of report. This type of reporting is usually handled better by the presentation tool (SSRS, Excel etc) than in T-SQL.
    If you do not provide sample DDL and INSERT scripts , how do you expect anyone to offer pertinent assistance?

    And quit double posting.
    https://www.sqlservercentral.com/Forums/2017374/Year-By-Months-Columns

    Thanks!!! The solution Dynamics Pivot!

  • angelreynosog - Wednesday, January 23, 2019 6:59 AM

    Jeff Moden - Tuesday, January 22, 2019 9:30 PM

    Phil Parkin - Tuesday, January 22, 2019 3:32 PM

    angelreynosog - Tuesday, January 22, 2019 2:23 PM

    Good afternoon

    I would like a script that can generate the following query, but that has the possibility to see also see the previous years with their months. It is more like a fiscal period, which contains years and months.

    Thanks

    This is a requirement, not a question. Which part of all of this is proving difficult for you?
    Your results look like a cross tab type of report. This type of reporting is usually handled better by the presentation tool (SSRS, Excel etc) than in T-SQL.
    If you do not provide sample DDL and INSERT scripts , how do you expect anyone to offer pertinent assistance?

    And quit double posting.
    https://www.sqlservercentral.com/Forums/2017374/Year-By-Months-Columns

    Thanks!!! The solution Dynamics Pivot!

    Heh... Again, I don't recommend using the PIVOT operator.  I recommend using the lost "Black Art" of CROSSTABs.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 6 posts - 1 through 5 (of 5 total)

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