Errors being generated in Date Table

My Power BI report is generating the following M code and therefore 1826 errors.
I am using Melissa’s Date Table.
This worked fine until this morning when I refreshed it.
Nothing has changed in my Queries.

See attached M Code for the error.


Source = Dates,
#“Detected Type Mismatches” = let
tableWithOnlyPrimitiveTypes = Table.SelectColumns(Source, Table.ColumnsOfType(Source, {type nullable number, type nullable text, type nullable logical, type nullable date, type nullable datetime, type nullable datetimezone, type nullable time, type nullable duration})),
recordTypeFields = Type.RecordFields(Type.TableRow(Value.Type(tableWithOnlyPrimitiveTypes))),
fieldNames = Record.FieldNames(recordTypeFields),
fieldTypes = List.Transform(Record.ToList(recordTypeFields), each [Type]),
pairs = List.Transform(List.Positions(fieldNames), (i) => {fieldNames{i}, (v) => if v = null or Value.Is(v, fieldTypes{i}) then v else error [Message = “The type of the value does not match the type of the column.”, Detail = v], fieldTypes{i}})
Table.TransformColumns(Source, pairs),
#“Added Index” = Table.AddIndexColumn(#“Detected Type Mismatches”, “Row Number” ,1),
#“Kept Errors” = Table.SelectRowsWithErrors(#“Added Index”, {“Date”, “Year”, “QuarterOfYear”, “MonthOfYear”, “DayOfMonth”, “DateInt”, “MonthName”, “MonthInCalendar”, “QuarterInCalendar”, “Day of Year”, “DayInWeek”, “DayOfWeekName”, “WeekEnding”, “MonthEnding”, “Week Number”, “MonthnYear”, “QuarternYear”, “Fiscal Year”, “Fiscal Quarter”, “Fiscal Period”, “IsAfterToday”, “IsWorkingDay”, “IsHoliday”, “WeekOffset”, “MonthOffset”, “QuarterOffset”, “YearOffset”, “FiscalYearOffset”, “PYTD”, “CompletedWeek”, “CompletedMonth”, “CompletedQuarter”, “Current Month”}),
#“Reordered Columns” = Table.ReorderColumns(#“Kept Errors”, {“Row Number”, “Date”, “Year”, “QuarterOfYear”, “MonthOfYear”, “DayOfMonth”, “DateInt”, “MonthName”, “MonthInCalendar”, “QuarterInCalendar”, “Day of Year”, “DayInWeek”, “DayOfWeekName”, “WeekEnding”, “MonthEnding”, “Week Number”, “MonthnYear”, “QuarternYear”, “Fiscal Year”, “Fiscal Quarter”, “Fiscal Period”, “IsAfterToday”, “IsWorkingDay”, “IsHoliday”, “WeekOffset”, “MonthOffset”, “QuarterOffset”, “YearOffset”, “FiscalYearOffset”, “PYTD”, “CompletedWeek”, “CompletedMonth”, “CompletedQuarter”, “Current Month”})
#“Reordered Columns”

Hi @GuyJohnson,

Are you using the latest version? If not, please update and report back. When still encountering errors, share the file in this thread.



I copied in the Data M Code from Enterprise DNA site and my entire model blew up. Anything Date related is broken even though all the relationships are in place.

Cannot copy my pbix model as this is extremely sensitive company Sales information.

Thanx for your help I’ll go back and start over with a new model.


I meant any file in which you are able to reproduce the error will do @GuyJohnson
For example an xlsx or pbix with nothing other than the Date table. Certainly do not share any sensitive data on an open forum like this.

Good luck.