Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Error refreshing a table: Cannot apply operator...to types number and null

I can't see to clear this error I checked all data types and ensured the monetary values are set to decimal number. There are null values in the dataset but not sure why it doesn't like that?    Ca...
  • MarcelBeug's avatar
    MarcelBeug
    9 years ago

    Actually the issue is 1 step earlier where you add a column with all dates from start_date through end_date.

    If either of these dates is null, then it won't work.

    My best guess is that end_date's are missing.
    My suggestion would be to use todays date if you have no end date (or something else you can think of), something like:

     

    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each { Number.From([start_date])..Number.From(if [end_date] = null then DateTime.Date(DateTime.LocalNow()) else [end_date]) }),

     

    Remark: I adjusted the code out of my head, hopefully it's OK.