0
votes

I am trying to make my power query more dynamic, currently I request my data using a stored procedure including part-no parameter that I hard-code into my query

EXEC GSCM_Staging.dbo.top_N_BOM 
    @Top_Parts = 'GL158K380G03|GL302K479G02|GL825R339G06|GL825R367G03|GL212R585G06'

I already have the individual part numbers in a list from a table in Excel

enter image description here

How would I go about converting this column with 4 rows into a column with a single pipe delimited row (Like the one used in my SQL query)

1

1 Answers

2
votes

Fairly easy

Beginning from your Source table

  1. first convert the table to list

    ListOfParts = Source[TOP_PART]
    
  2. then concatenate the list into delimited text

    JoinedText = Text.Combine(ListOfParts, "|")
    
  3. further modify it if required

    PartsFilter = "'" & JoinedText "'"
    

In short

let
    Source = Table.CurrentWorkbook.....
    ListOfParts = Source[TOP_PART]
    JoinedText = Text.Combine(ListOfParts, "|")
    PartsFilter = "'" & JoinedText "'"
in PartsFilter