+ Reply to Thread
Results 1 to 3 of 3

Tabulating Source Data using Power Query

Hybrid View

  1. #1
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2019
    Posts
    4,542

    Tabulating Source Data using Power Query

    Dear All

    Need help with a PQ problem, to format source data into a database table as follows:

    PQ Problem.png

    Thank you in advance!

    Joseph
    Attached Files Attached Files

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: Tabulating Source Data using Power Query

    Please try

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        SplitbyDelimiter = Table.SplitColumn(Table.TransformColumnTypes(Source, {{"STOCK CODE", type text}}, "en-US"), "STOCK CODE", Splitter.SplitTextByEachDelimiter({": "}, QuoteStyle.Csv, true), {"STOCK CODE", "No"}),
        AddedOutlet = Table.AddColumn(SplitbyDelimiter, "OUTLET CODE", each if [STOCK CODE] = "OUTLETCODE " then [No] else null),
        AddedBuyer = Table.AddColumn(AddedOutlet, "BUYER NO", each if [STOCK CODE] ="BUYERNO " then [No] else null),
        FilledDown = Table.FillDown(AddedBuyer,{"OUTLET CODE", "BUYER NO"}),
        FilteredRows = Table.SelectRows(FilledDown, each ([STOCK ITEM] <> null)),
        SelectColumns = Table.SelectColumns(FilteredRows,{"OUTLET CODE", "BUYER NO", "STOCK CODE", "STOCK ITEM", "QTY"})
    in
        SelectColumns

    STOCK CODE is Text, change type to Number if need.
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2019
    Posts
    4,542

    Re: Tabulating Source Data using Power Query

    Thank you, Bo_Ry! Works perfectly! Here's a rep for you.

+ 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. Modify csv data source that is connected to a XLSM file via power query
    By TheRevenant in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-15-2020, 12:27 PM
  2. [SOLVED] Blank cells in Power Query, data existing in original source
    By kirootsouthpark in forum Excel General
    Replies: 4
    Last Post: 08-25-2020, 05:05 PM
  3. Replies: 0
    Last Post: 08-25-2020, 03:56 PM
  4. [SOLVED] Power Query Only selecetd(parametrs) data to be download from source
    By hudson andrew in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-09-2020, 03:09 PM
  5. Replies: 0
    Last Post: 01-14-2019, 12:59 PM
  6. Power Query Source vs Different PCs
    By flpneves in forum Excel General
    Replies: 1
    Last Post: 12-05-2017, 01:07 PM
  7. Dropbox Data Host/Source for Power Query
    By mielkew27 in forum Excel General
    Replies: 0
    Last Post: 04-09-2017, 11:49 PM

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