none
result List.Accumulate to Table RRS feed

  • Question

  • I have List Value

    let
        Source = AllDays,
        FilteredRows = Table.SelectRows(Source, each [Date] >= StartEndDates{0}[StartDate] and [Date] <= StartEndDates{0}[EndDate]),
        SumDays = List.Accumulate( FilteredRows[IsWorkDay], 0 , (state, current) => state + current)
    in
        SumDays

    how to insert a value into the table

    I do

    let
        Source = AllDays,
        FilteredRows = Table.SelectRows(Source, each [Date] >= StartEndDates{0}[StartDate] and [Date] <= StartEndDates{0}[EndDate]),
        SumDays = List.Accumulate( FilteredRows[IsWorkDay], 0 , (state, current) => state + current),
        ChangedType = Table.TransformColumnTypes(SumDays,{{"Value", type number}})
    in
        ChangedType

    But I have ERROR

    Expression.Error: Cannot convert the value 11 to type Table.
    Details:
        Value=11
        Type=Type

    Help please


    Tuesday, April 14, 2015 10:47 PM

Answers

  • You need to add the value to the table with something like

    AddedColumn = Table.AddColumn(FilteredRows, "Value", each SumDays, type number)

    Tuesday, April 14, 2015 11:03 PM

All replies