let
// Assuming "Table" is the name of your table and "Date" is the name of your date column
// Find the previous date with a non-null value
FillDates = (currentDate) =>
let
previousDate = List.LastN(Table.SelectRows(Table, each [Date] < currentDate and [Date] <> null), 1),
result = if List.Count(previousDate) = 0 then currentDate else Record.Field(previousDate{0}, "Date")
in
result,
// Fill null values based on the previous day's value
CustomColumn = Table.AddColumn(Table, "FilledDate", each FillDates([Date])
in
CustomColumn
No comments:
Post a Comment