Results 1 to 6 of 6
  1. #1
    breezett93 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2017
    Posts
    53

    Consolidate multiple rows into one for a report

    Click image for larger version. 

Name:	1.PNG 
Views:	15 
Size:	7.4 KB 
ID:	40385

    Included is a picture of the result of a query. I need the non-zero value from each row saved and merged into just one row (Whoever designed the table I'm working with didn't plan ahead very well). There is more data beyond the image in each row, but they are all identical; because I'm really dealing with just one item.

    I'm getting a blank report, and I think it's because it doesn't know which row to pick (should be the top one); so I'm hoping my consolidation solution will work.

    Any thoughts on the best way to combine each row, then delete the remaining five? If I had a second item, then twelve rows would be generated; so some form of looping is required as well.



    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Start a new query and add all those fields. Click on the Totals icon in the ribbon. Change Group By to Max for all the fields except the first one, and see if that gets the result you want.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    This is an easy task using Power Query. Here is the Mcode. I used an excel sheet to recreate your situation, but importing a query into PQ can achieve the same results.

    Code:
    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Ordid", Int64.Type}, {"ETop", type number}, {"ELeftOS", type number}, {"ELeftIS", type number}, {"ERightOS", type number}, {"ERightIS", type number}, {"Ebottom", type number}}),
        #"Replaced Value" = Table.ReplaceValue(#"Changed Type",0,null,Replacer.ReplaceValue,{"ETop", "ELeftOS", "ELeftIS", "ERightOS", "ERightIS", "Ebottom"}),
        #"Filled Up" = Table.FillUp(#"Replaced Value",{"ETop", "ELeftOS", "ELeftIS", "ERightOS", "ERightIS", "Ebottom"}),
        #"Removed Bottom Rows" = Table.RemoveLastN(#"Filled Up",5)
    in
        #"Removed Bottom Rows"
    Attached Files Attached Files

  4. #4
    breezett93 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2017
    Posts
    53
    That worked. Thank you!

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Whoever helped was happy to do so.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Concur with Paul.

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

Similar Threads

  1. Consolidate Data from Multiple Columns
    By jmoodley in forum Access
    Replies: 4
    Last Post: 04-24-2018, 12:56 PM
  2. Replies: 1
    Last Post: 01-10-2014, 08:35 AM
  3. Consolidate Multiple Names
    By psquire in forum Access
    Replies: 3
    Last Post: 06-12-2013, 08:21 AM
  4. Consolidate Multiple Names
    By psquire in forum Queries
    Replies: 1
    Last Post: 06-11-2013, 08:45 PM
  5. Consolidate multiple columns into one
    By COforlife in forum Access
    Replies: 17
    Last Post: 10-19-2009, 01:12 PM

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