transposing date column to rows

  • Hello people,

    I am trying to transpose date column to rows. I am not sure if this can be done for more than 10000+ rows.

    For example, I am trying to convert the table in image 1 to image 2. Please note that the below is just a example extract of the data , the total rows I am trying to transpose are 10000+

     

    Image 1 - Original Data

     

    Image 2 - transposed data

    I tried searching the web for answers but just couldn't find one, please let me know if this is possible or not?

     

    Thanks!

  • Have a read of Jeff Moden's articles Cross Tabs and Pivots. They explain exactly how to achieve what you're after.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Thom A wrote:

    Have a read of Jeff Moden's articles Cross Tabs and Pivots. They explain exactly how to achieve what you're after.

    And the second article describes how to do it dynamically!

    And thanks for the reference, Thom.

    --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)

  • Thank you for the descriptive explanation, I got what I wanted.

  • Good day

    sidlfc08,

    I would like to do the same condition ( transposing date column to rows )

    Can you please share with me your query statement to solve your initial question.

    I have already read the crosstabs and pivots by jeff moden's article but i am still confused.

    Seeking for your generous help.

    Thank you.

     

  • gonfrics wrote:

    Good day

    sidlfc08,

    I would like to do the same condition ( transposing date column to rows )

    Can you please share with me your query statement to solve your initial question.

    I have already read the crosstabs and pivots by jeff moden's article but i am still confused.

    Seeking for your generous help.

    Thank you.

    Where did you get confused? The linked articles have example queries, so what about those didn't you understand? What is your current attempt?

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Below is the result that i want to accomplish , I want to transpose the column dates into row headers and the values of current status will be the value corresponding to each date.

    TRANSPOSE

  • But where did you get confused in the article? I assume you want a dynamic pivot, which the articles do explain.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

Viewing 8 posts - 1 through 7 (of 7 total)

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