Results 1 to 4 of 4
  1. #1
    warren0127 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    May 2015
    Posts
    69

    Moving Data from Rows to Columns in Query - How to do this?

    Hi all,

    I know there was a similar post out there, but my situation is a bit different. The good news is, I don't have to work with too many levels of data here.

    So, basically what I need to do is setup a query that displays an ID (Task Name) and the Fiscal Year Amounts. So, each ID should have Fiscal Year Amounts for FY15 through FY21 which should be extracted from the ROW data (FiscalYear and Amount). The Amount is next to each FY row - I just need to put the amounts in columns now for each Fiscal Year.

    I have built a table for the funding which has the three columns mentioned above (ID, FY, Amount). Instead of creating multiple columns for each fiscal year, I just created a "Fiscal Year" column that allows a user to pick a FY with a dropdown of FY15 through FY21.

    The query will be using the attached table below. I've also attached the query screenshot of both datasheet view and design view.

    What I need to do:

    Ultimately, I want to turn the results of this query into a report. So, somehow, I need to display each Task Name (ASTMIS ID) with the funding amounts of each fiscal year, so it would look like this:

    ASTMIS_ID FY16 Amount FY17 Amount FY18 Amount
    Energy Informed Operations XXXX XXXX XXXX
    Mission Command on the Move Technologies XXXX XXXX XXXX




    I need to have the query understand the row data - IE: FY15 amounts all displayed in one column for each task name, FY16 amounts all displayed in second column, etc. I've attached a query screenshot of what I am trying to do (right now, I have the fields "FiscalYear" and "Amount" combined or concatencated because I was hoping I could figure it out that way, or thought that was a starting direction.. but turns out, I am still stumped.)

    It should basically summarize each fiscal year and the dollar amounts that are associated with those fiscal years to be in their own COLUMNS. So, how would I take all of those FiscalYear rows with their amounts, and put them into their own columns to show amounts for each year?

    Any help is appreciated - I'm not an Access expert, nor SQL - but I am trying to learn as much as I can!



    Thanks!!
    Attached Thumbnails Attached Thumbnails QueryDesignView.png  
    Last edited by warren0127; 05-06-2015 at 06:01 AM.

  2. #2
    Demerit's Avatar
    Demerit is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2013
    Posts
    125
    What you want to do can be done using a crosstab query.
    Simply use the wizard and choose crosstab query.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    warren0127 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    May 2015
    Posts
    69
    Thanks for showing me the CrossTab option - I had no clue that was a simple solution to my problem, and worked fantastic! Thank you!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Pivot Table - Moving Values from Columns to Rows
    By charlatain in forum Access
    Replies: 3
    Last Post: 07-21-2013, 01:41 PM
  2. moving and adding rows of data
    By clmunson in forum Forms
    Replies: 4
    Last Post: 07-25-2012, 02:29 PM
  3. Query to transpose Data in Columns to Rows
    By ace1259 in forum Access
    Replies: 2
    Last Post: 04-10-2012, 01:49 PM
  4. Replies: 5
    Last Post: 03-29-2012, 09:21 PM
  5. moving column data to rows
    By teasdam in forum Access
    Replies: 3
    Last Post: 12-23-2011, 08:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums