none
Expression.SyntaxError: Token Comma expected. RRS feed

  • Question

  • Hello,

    What is wrong with this?

    let
        Source = Excel.CurrentWorkbook(){[Name="StartDate"]}[Content],
        #"Changed Type with Locale" = Table.TransformColumnTypes(Source, {{"StartDate", type number}}, "en-GB"),
        SD = #"Changed Type with Locale"{0}[StartDate],
        LDS = List.Dates(SD, Number.From(DateTime.LocalNow())- Number.From(SD)  ,#duration(1,0,0,0)
    in
        LDS

    Friday, April 13, 2018 6:02 PM

Answers

  • It won't work because the StartDate column values are numbers, and not dates.

    Modify the changed type step as follows:

    #"Changed Type with Locale" = Table.TransformColumnTypes(Source, {{"StartDate", type date}}, "en-GB"),

    • Marked as answer by andy.lev Friday, April 13, 2018 8:24 PM
    Friday, April 13, 2018 8:20 PM

All replies

  • The fourth step looks like it needs a closing parenthesis.
    Friday, April 13, 2018 6:35 PM
  • You're missing a closing parenthesis for the List.Dates function.

    Syntax error messages aren't smart, and I get the wrong message about 50% of the time for an unclosed parenthesis. However, the message just tells me that something is wrong, and that I have to hunt down the problem.

    Friday, April 13, 2018 6:39 PM
  • ok, but now is

    Expression.Error: We cannot convert the value 43101 to type Date.
    Details:
        Value=43101
        Type=Type

    maybe date shouldn't be converted to a number?

    Friday, April 13, 2018 6:42 PM
  • right, I fixed it :) thanks but....

    Expression.Error: We cannot convert the value 43101 to type Date.
    Details:
        Value=43101
        Type=Type

    Friday, April 13, 2018 6:44 PM
  • It won't work because the StartDate column values are numbers, and not dates.

    Modify the changed type step as follows:

    #"Changed Type with Locale" = Table.TransformColumnTypes(Source, {{"StartDate", type date}}, "en-GB"),

    • Marked as answer by andy.lev Friday, April 13, 2018 8:24 PM
    Friday, April 13, 2018 8:20 PM
  • You are my hero :)

    I tried to change source to be a date not any but it doesn't work

    many thanks and have a nice day :)

    Friday, April 13, 2018 8:26 PM