Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RogerioPRJ
Regular Visitor

Replace blank space just the first row

Hello,

 

How I replace blank space just the first row of my data set

 

Sem título.png

 

1 ACCEPTED SOLUTION

@RogerioPRJ

 

If I understand the probem correctly..

 

One way could be to transpose your Table>>>This means your first row would be in first column>>>Now you can TRIM or Clean this Column

>>
Now transpose it back



Second way could be to use Record.TransformFields function to clean the first record

Please see the attached file's Query Editor for illustration of these 2 methods

 

let

    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WiipNSswsUlBQ0lFSUFBwysxJzAFzPBKLE/PALLiKWJ1oJROggDEQGwKxCVjEHMiyhIqYgUUswXIQUXOwiBlMjQFYIUgIzDSCqjRWio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]),
    
 RemoveSpaces=Record.TransformFields(Source{0},{{"Column1",Text.Trim},{"Column2",Text.Trim},{"Column3",Text.Trim},{"Column4",Text.Trim}}) ,
 AddRows=Table.InsertRows(Source,1,{RemoveSpaces}),
    #"Removed Top Rows" = Table.Skip(AddRows,1)  

in
    #"Removed Top Rows"

 

 


Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Ragnarock1982
Frequent Visitor

Hi,

 

You can change that first row to a header . .

 

On the Home tab, click edit queries. Then on the Transform tab in the queries screen click the option that says 'Use First Row as Headers'.

 

I couldn't see a blank space in your screenshot, so I guess that you mean this?

@RogerioPRJ

 

If I understand the probem correctly..

 

One way could be to transpose your Table>>>This means your first row would be in first column>>>Now you can TRIM or Clean this Column

>>
Now transpose it back



Second way could be to use Record.TransformFields function to clean the first record

Please see the attached file's Query Editor for illustration of these 2 methods

 

let

    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WiipNSswsUlBQ0lFSUFBwysxJzAFzPBKLE/PALLiKWJ1oJROggDEQGwKxCVjEHMiyhIqYgUUswXIQUXOwiBlMjQFYIUgIzDSCqjRWio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]),
    
 RemoveSpaces=Record.TransformFields(Source{0},{{"Column1",Text.Trim},{"Column2",Text.Trim},{"Column3",Text.Trim},{"Column4",Text.Trim}}) ,
 AddRows=Table.InsertRows(Source,1,{RemoveSpaces}),
    #"Removed Top Rows" = Table.Skip(AddRows,1)  

in
    #"Removed Top Rows"

 

 


Regards
Zubair

Please try my custom visuals

Tks

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.