+ Reply to Thread
Results 1 to 7 of 7

Combining 2 table for PL statement and Raw Data | Power Query

  1. #1
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2019
    Posts
    209

    Combining 2 table for PL statement and Raw Data | Power Query

    Hi everyone,

    I have an issue where I have a two tables and need to be combined together, first one is the description of Profit and Loss and second table is the raw data . The complication that I have is where In the Profit and loss has a subtotal. In the first table(GL Description) you will see there is a subtotal for A, which is summing A1 + A2 + A3 and Subtotal B (B1+ B2) and Subtotal C (C1 + C2 + C3) and Grand Total (A + B + C)

    Is this possible to use both power query and power pivot to generate the result shown in row 18 onwards ?

    Much appreciated for your help.

    Thanks

    Lex

    Also crossposting here https://www.myonlinetraininghub.com/...atement#p25381
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Combining 2 table for PL statement and Raw Data | Power Query

    D3=IFERROR(VLOOKUP(C3,RawData,2,0),0)

    E3=IF(LEFT(B3,3)="sub","",LEFT(C3,1))

    After that a pivot table.

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,861

    Re: Combining 2 table for PL statement and Raw Data | Power Query

    Added a grouping to allow this data to be pivoted.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2019
    Posts
    209

    Re: Combining 2 table for PL statement and Raw Data | Power Query

    Hi Alan,

    Thanks Alan for your reply. I've got couple a question, first one, how do you created MergedData table (I cant find the source data?)

    I am just wandering because the way that our data set up that I have another relational data table (see attached Jpg) where it tells us the GL item and the relationship
    e.g Say GL A1 should return A1, A2 return A2 and GL A should return summation of A1 A2 and A3.

    Can that be done in Power Query ?

    The reason being that this is a sample worksheet and when it does get scale up , I do not want to hold too many data , just the lowest denominator GL and using Relationship to add them all together.

    Thanks in advanced

    Lex
    Attached Images Attached Images
    Attached Files Attached Files

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,861

    Re: Combining 2 table for PL statement and Raw Data | Power Query

    The merge table was a left inner join of your two tables. Click on Query and Connections on the Data Tab to open that window so you can look at each of the Mcodes to set that merge up.

  6. #6
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Sydney
    MS-Off Ver
    Excel 2019
    Posts
    209

    Re: Combining 2 table for PL statement and Raw Data | Power Query

    Hi,

    after a weekend and refresh mind, I have added another table called relationship, this will tell that certain subtotal is addition of certain GL, can that be done.
    Now I have created a table with single GL shown, but not the subtotal! Is this the way to go ? like can power query do this or is it something i need to use measure ?

    Not 100% , newbie at power query here !

    see v2 of P&L

    Thanks
    Lex
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Combining 2 table for PL statement and Raw Data | Power Query

    This proposal does not involve Power Query, however I feel that the output is close to what you want.
    1. Add a column to the data in columns A:C that indexes the amount from column H: =IFERROR(INDEX(H$2:H$7,MATCH(C2,G$2:G$7,0)),0)
    2. Add another column to identify the grouping of the GL's: =LEFT(C2,1)
    3. Remove the Subtotal and Grand Total rows
    4. Produce a pivot table as modeled in M17:O29
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Combining mulitple tables into one using Power Query
    By samparker095 in forum Excel General
    Replies: 23
    Last Post: 04-26-2022, 05:24 AM
  2. Create slicer for regular table in Power Query (Get Data)
    By Sgilmore in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-22-2021, 08:43 AM
  3. Sorting Pivot Table Pulling from Power Query Data Table
    By perkyparker in forum Office 365
    Replies: 1
    Last Post: 05-22-2021, 03:02 PM
  4. Replies: 1
    Last Post: 03-18-2021, 01:06 PM
  5. [SOLVED] Power Query to Convert Data Range to a Table
    By andrewc in forum Excel General
    Replies: 3
    Last Post: 07-30-2020, 04:14 AM
  6. Updating a table with new data in power query
    By SueBristow in forum Excel General
    Replies: 0
    Last Post: 04-02-2020, 03:53 PM
  7. Adding data to the end of a table with Power Query
    By afila in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-14-2016, 08:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1