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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Delete rows in Pbi using two criteria

Hello community, I have the following problem in pbi:

From this table in power bi, I need to delete row records according to FECHA PAGO column and INDICE column, I need to leave a single row for each DATE that contains the largest INDEX value:

ORIGIN TABLE

 

Yamil_0-1694030783442.png

The table should look like this:

 

Yamil_1-1694030824838.png

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

You can put the following code to advanced editor in power query

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8sxLL0otzlfSUXLOLyoBUob6FvpGBkbGQKaRoaWFUqwOQUXmxCgyI0aRMboi52Agaa5vbIhQZIzhJmyKIG4KSEzHqcIMWYVvYhGmClOCKkyUYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Movim = _t, Conce = _t, Date = _t, Indi = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Movim", type text}, {"Date", type date}, {"Indi", Int64.Type}}),
    #"Added Custom1" = Table.AddColumn(#"Changed Type", "Custom", each if [Indi]=List.Max(Table.SelectRows(#"Changed Type",(x)=> x[Date]=[Date])[Indi]) then 1 else 0),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom1", each ([Custom] = 1)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Custom"})
in
    #"Removed Columns"

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous 

You can put the following code to advanced editor in power query

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8sxLL0otzlfSUXLOLyoBUob6FvpGBkbGQKaRoaWFUqwOQUXmxCgyI0aRMboi52Agaa5vbIhQZIzhJmyKIG4KSEzHqcIMWYVvYhGmClOCKkyUYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Movim = _t, Conce = _t, Date = _t, Indi = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Movim", type text}, {"Date", type date}, {"Indi", Int64.Type}}),
    #"Added Custom1" = Table.AddColumn(#"Changed Type", "Custom", each if [Indi]=List.Max(Table.SelectRows(#"Changed Type",(x)=> x[Date]=[Date])[Indi]) then 1 else 0),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom1", each ([Custom] = 1)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Custom"})
in
    #"Removed Columns"

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

slorin
Super User
Super User

Hi,

 

= Table.FromRecords(Table.Group(Your_Source, {"DATE"}, {{"Data", each Table.Max(_,{"INDEX"}), type record}})[Data])

Stéphane 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors