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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Stuartm1983
Helper III
Helper III

Removing Blocks - Data Preparation

Hi,

 

I'm looking to prepare my data with repeating blocks. Could anyone please help me as to how to remove the first block only (1-null)?

 

ColumnAColumnB
1

a

 

2c
3d
nulls
5a
nullf
1f
2r
nullu

 

The break is null.

 

Thanks

 

S

1 ACCEPTED SOLUTION

@Stuartm1983 Ah, try this:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUpUitWJVjICspLBLGMgKwXMyivNyQFyisEcU7hSqHAamGMIZ4FMKEJWUKoUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ColumnA = _t, ColumnB = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ColumnA", Int64.Type}, {"ColumnB", type text}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type),
    #"Sorted Rows" = Table.Sort(#"Added Index",{{"Index", Order.Ascending}}),
    FirstNull = List.PositionOf(Table.Column(#"Sorted Rows","ColumnA"), null),
    FinalTable = Table.SelectRows(#"Sorted Rows",each [Index]>FirstNull)
in
    FinalTable


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Stuartm1983
Helper III
Helper III

Thank you 🙂

Stuartm1983
Helper III
Helper III

thanks for answering but I think you're misunderstanding my problem. I have not been too clear.

 

Basically I want to remove rows 1,2,3,null at the top each refresh. But these rows change in size but there is always a break of null.

@Stuartm1983 Ah, try this:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUpUitWJVjICspLBLGMgKwXMyivNyQFyisEcU7hSqHAamGMIZ4FMKEJWUKoUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ColumnA = _t, ColumnB = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ColumnA", Int64.Type}, {"ColumnB", type text}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type),
    #"Sorted Rows" = Table.Sort(#"Added Index",{{"Index", Order.Ascending}}),
    FirstNull = List.PositionOf(Table.Column(#"Sorted Rows","ColumnA"), null),
    FinalTable = Table.SelectRows(#"Sorted Rows",each [Index]>FirstNull)
in
    FinalTable


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

@Stuartm1983 Try Trim operation in Power Query? Or Trim and Clean just to be safe?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.