+ Reply to Thread
Results 1 to 6 of 6

Data compilation using Power Query

  1. #1
    Registered User
    Join Date
    09-14-2018
    Location
    Warsaw, Poland
    MS-Off Ver
    2016
    Posts
    10

    Data compilation using Power Query

    Hello,

    Using Power Query, I managed to get some data, but they are "fragmented", i.e. the data is in three tables below each other and make it difficult for me to quickly obtain data from them. I was able to consolidate them using the PivotTable and PivotChart wizard, which can be seen in the "expected effect" sheet. However, the data refresh on a regular basis and I am not sure if the ranges of this data will not change (maybe the number of these tables will also change). Is it possible that these pivot tables are created automatically using a macro or Power Query?

    Thanks in advance
    Attached Files Attached Files

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: Data compilation using Power Query

    Since you don't have any query in your workbook. I'm guessing 3 tables are brought in using 3 separate queries.

    If so, just unpivot all but [Data Date] and append tables together. Or simply merge tables based on [Data Date] column.

    If it's brought in using single query... You'd need additional transformation steps to separate out each table.

    Can you confirm how the data is brought in?
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    09-14-2018
    Location
    Warsaw, Poland
    MS-Off Ver
    2016
    Posts
    10

    Re: Data compilation using Power Query

    The thing is that I download this by one query in exactly the same form as in "data" sheet. Here is my query:

    Please Login or Register  to view this content.
    I combine this with the defined name "paths" because the link depends on the date -> these are periodic data
    Last edited by Szymon.L; 09-17-2018 at 10:04 AM.

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: Data compilation using Power Query

    Here's how I would do it.

    1. Load everything to Query (Tabela1).
    2. Demote Headers to first row.
    3. Add [Index].
    4. Add [Custom] using follwing.
    Please Login or Register  to view this content.
    5. Filter out nulls using [Column1].
    6. Reference Tabela1 and name it fnUnpivot.
    7. Added transformation steps (#"Filtered Rows", #"Removed Columns", #"Promoted Headers", & #"Unpivoted Columns").
    8. Convert it to function by adding argument for fVal.
    Complete "M" for fnUnpivot.
    Please Login or Register  to view this content.
    9. Add blank query and add source as below, and convert to table.
    Please Login or Register  to view this content.
    10. Add custom column invoke fnUnpivot([Column1])

    11. Expand and remove [Column1]

    I have stopped at this point, as I noticed bunch of values that'll need clean up. As you have text mixed in with numeric (1,13*, 1,17*, 1,51*, 19,60*, 22,53* & n.d.).
    I wasn't sure how these should be treated.

    See attached to steps up to #11.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-14-2018
    Location
    Warsaw, Poland
    MS-Off Ver
    2016
    Posts
    10

    Re: Data compilation using Power Query

    Thanks, this could be solved just by find and replace a text or a number on a worksheet, what I would ike to see in results is "**" in particular columns. I have some doubts if I right understood your 3 and 4 points - by adding [Index] and [Custom] You mean adding a new query? So code for new query [Custom] is given below 4 point and what about code for [Index].

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: Data compilation using Power Query

    3 - You add Index column. It doesn't matter if it is 0 base or 1 base in this case. You should find in Add Column ribbon tool.

    4 - You add Custom column with the function mentioned. This step is needed to assign grouping to each set of table and to merge/append tables to each other.

    If you go into query editor, you can follow steps in Applied steps pane.
    Last edited by CK76; 09-18-2018 at 10:33 AM. Reason: Typo

+ 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. POWER Query and Power Pivot Table !!
    By haitham.shop in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-06-2018, 04:09 PM
  2. Power Query and Power Pivot Table
    By haitham.shop in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-06-2018, 06:17 AM
  3. Power Query and Power Pivot Table !!
    By haitham.shop in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-06-2018, 06:15 AM
  4. POWER Query and Power Pivot Table !!
    By haitham.shop in forum Access Tables & Databases
    Replies: 0
    Last Post: 08-06-2018, 05:59 AM
  5. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM
  6. Replies: 0
    Last Post: 04-05-2018, 01:16 AM
  7. error in power query & power pivot
    By Baldev Kumar in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 01-03-2018, 01:34 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