cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
LAPORTES Member
Member

Power Query : space before text

Hi,

 

Here is my plain issue :

 

i've got a 2 column dataset

 

Lib           Nb_Pad
Pad1       1
Pad2       2
Pad10     10
Pad5       5

 

 

I've seen that using the formula Text.PadStart
it was possible to do something like this :

 

Pad_Lib

 Pad1
  Pad2
          Pad10
     Pad5

 

 

The thing is i'm not good enough to set that up in M.   -:)

 

I think of something like :

 

-------- M -------
let
    Source = Excel.Workbook(File.Contents("MyPath\Myfile.xlsx"), null, true),
    Order_Sheet = Source{[Item="Order",Kind="Sheet"]}[Data],
    Promote = Table.PromoteHeaders(Order_Sheet, [PromoteAllScalars=true]),
// insert a step here that will do the pading trick !!
    Pad = Table.TransformColumns(Promote, {{"Lib", each Text.Padstart("Lib", "Nb_Pad"), type text}})

in
    Pad
 
-------------

 

Thanks for your help !

 

Stephane

1 ACCEPTED SOLUTION

Accepted Solutions
LAPORTES Member
Member

Re: Power Query : space before text

Found the solution. I leave it for the one who need it. https://www.fourmoo.com/2015/03/25/power-query-adding-leading-zero-to-number-eg-month-number/ Thanks to this blogger.

View solution in original post

1 REPLY 1
LAPORTES Member
Member

Re: Power Query : space before text

Found the solution. I leave it for the one who need it. https://www.fourmoo.com/2015/03/25/power-query-adding-leading-zero-to-number-eg-month-number/ Thanks to this blogger.

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 396 members 4,109 guests
Please welcome our newest community members: