Forum Discussion
query.Experssion.Error - not seeing the cause
I have this function which is producing the error
An error occurred in the ‘’ query. Expression.Error: The name 'BytesPerIncrement' wasn't recognized. Make sure it's spelled correctly.
I cannot tell why BytesPerIncrement is producing this error and RemainingBytes is not.
(firstRows as table, t as table, procCal as list) as table =>
let
prevRows = Table.ToRecords(t),
newRows = List.Transform(prevRows, (row) => Record.TransformFields( row, {
let
posrow = List.PositionOf(prevRows, row),
RemainingBytes = fnRemBytes(posrow, prevRows, firstRows),
BytesPerIncrement = fnBytesInc2(posrow, prevRows, firstRows, procCal),
ScheduleIncrements = if BytesPerIncrement > 0
then prevRows{posrow}[Schedule Increments] - 1
else
if RemainingBytes = 0
then 0
else prevRows{posrow}[Schedule Increments],
RemainingDuration = if BytesPerIncrement > 0
then
if prevRows{posrow}[Remaining Duration] - SchedulingInterval < #duration(0,0,0,0)
then #duration(0,0,0,0)
else prevRows{posrow}[Remaining Duration] - SchedulingInterval
else
if RemainingBytes = 0
then 0
else prevRows{posrow}[Remaining Duration]
in
{"Remaining Bytes", each RemainingBytes},
{"Bytes Per Increment", each BytesPerIncrement},
{"Schedule Increments", each ScheduleIncrements},
{"Remaining Duration", each RemainingDuration},
{"EndDateTime", each null}
})
),
outRows = Table.FromRecords(newRows)
in
outRows