79139141

Date: 2024-10-29 22:16:47
Score: 1.5
Natty:
Report link

Was able to figure out a solution inspired by the "Filled Down" command from horseyride's answer.

Start.png

Starting here I had to add back in the null value in cells to allow the filled down command to work. I only added the null value where I needed based on the text contained in C001.

BlankToNull = Table.TransformRows(#"Renamed Columns", each if Text.Contains(_[C001], "Strata") then Record.TransformFields(_, {{"C002", each null}}) else _),
ExpandRecord1 = Table.FromRecords(BlankToNull),

Next.Png

After that I allowed the Fill Down command to populate all the null cells with values.

FilledDown = Table.FillDown(ExpandRecord1,{"C002"}),

Next2.png

Now I needed to clean the cells I didn't want to have the filled data in.

WhiteOut = Table.TransformRows(FilledDown, each if Text.Contains(_[C001], "Strata") and not Text.Contains(_[C001], "Total") then Record.TransformFields(_, {{"C002", each ""}}) else _),
ExpandRecord2 = Table.FromRecords(WhiteOut)

Finish.Png

I ended up with my desired result. Key takeaway for me was how to transform multiple cells in a column based on the values of cells in other columns. Accomplished this using the Table.TransformRows() command and passing through arguments such as Text.Contains().

Reasons:
  • Blacklisted phrase (0.5): I need
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Bryce