Build String From Excel Table Output From Power Query

wsnyder

Board Regular
Joined
Sep 23, 2018
Messages
224
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have some Tables that are output from Power Query
I'm currently building a string from some of the cells:

Code:
="•"&D7&CHAR(10)&
"•"&D8&CHAR(10)&
"•"&D9&CHAR(10)&
"•"&D10&CHAR(10)&
"•"&D11

Problem is when data is more lines or less lines.
Any ideas on a better process?

Thanks,
-w
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Maybe use the table structured reference and something like
Excel Formula:
textjoin(char(10),true, table[ColumnD])

But why not do this Inside PQ?
Power Query:
Text.Combine(PreviousStep[Column4], "#(lf)")
 
Upvote 0
Thanks GraH,

I'm trying to combine in PQ, but getting an error

Power Query:
let
    Source = WM,
    #"Filtered Rows" = Table.SelectRows(Source, each ([Market] = "x")),
    #"Added Custom" = Table.AddColumn(#"Filtered Rows", "BL_Merge", each Text.Combine([Bullet_Long],"#(lf)")),
    BL_Merge = #"Added Custom"{0}[BL_Merge]
in
    BL_Merge

Error:
Rich (BB code):
Expression.Error: We cannot convert the value "• Blah, blah, blah" to type List.

Thanks,
-w
 
Upvote 0
Stop the query at filtered rows.
Reference the query.
Select the column bullet_long and remove other columns.
Click on the fx icon of the formula bar. Keep the step name that get's inserted. Then precede this with Text.Combine(StepName[bullet_long], Delimiter).
 
Upvote 0
Solution
Thanks GraH,

That did exactly what I needed!


Power Query:
let
    Source = x,
    #"Removed Other Columns" = Table.SelectColumns(Source,{"Bullet_Long"}),
    Custom1 = Text.Combine(#"Removed Other Columns"[Bullet_Long],"#(lf)")
in
    Custom1

Thanks,
-w
 
Upvote 0

Forum statistics

Threads
1,223,649
Messages
6,173,585
Members
452,522
Latest member
saeedfiroozei

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top