Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello everyone!
I would like to ask help with solving my task.
I have 1 column in power bi which contains string values.
Here the example
In other words,
I need to start from down and minus previous row.
For example,
row 1 = "Marek"
row 2 = "Marek, Marek, Jakub". The result will be "Marek, Marek, Jakub" - "Marek" = "Marek, Jakub"
row 4 = "Jakub, Marek, Jakub". The result will be "Jakub, Marek, Jakub" - "Marek, Jakub" (what we get as a result in row 1) = "Jakub"
Thank you in advance for any suggestiona and advices,
Ekaterina
Your row number sequence is off for 13 and 15. Please clarify.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfJNLErNVorViVYygvF0FKCUV2J2aRJYzgQoB+ZhkTOHyYF5hgZAbkBiWX4OhGuMyjUFcoPz8xIhNhpAeToKEDIgtSS1CCIFchuYi0XOGCEHpYCOKsnMU4qNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Row = _t, Input = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Row", Int64.Type}, {"Input", type text}}),
#"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "Result", each List.Accumulate({0..[Index]},"",(state,current)=>
let p = Text.PositionOf(#"Added Index"[Input]{current},state)
in if p=-1 then #"Added Index"[Input]{current} else Text.RemoveRange(#"Added Index"[Input]{current},p,Text.Length(state))),type text),
#"Replaced Value" = Table.ReplaceValue(#"Added Custom",each [Result],each if Text.StartsWith([Result],", ") then Text.RemoveRange([Result],0,2) else [Result],Replacer.ReplaceValue,{"Result"})
in
#"Replaced Value"
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.