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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.