Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
BenTen22
Regular Visitor

Token Equal Expected

Hey all,

 

I'm getting Token Equal expected for the second to last column i'm adding (highlighted). Can't for life of me workout why though. Any tips would be much appreciated.

 

= let
Dates = BaseDateTable,
CurrentDate = DateTime.Date(DateTime.LocalNow()),
CurrentYear = Date.Year(DateTime.Date(DateTime.LocalNow())),
CurrentMonth = Date.Month(DateTime.Date(DateTime.LocalNow())),
FilteredDates =
Table.SelectRows(
Dates,
each [Date] >=
Date.AddYears(CurrentDate,-3) and [Date] <=CurrentDate
),
DateCol = Table.SelectColumns(FilteredDates,"Date"),
YearCol =
Table.AddColumn(
DateCol, "Year", each Date.Year([Date]), Int64.Type
),
MonthNameCol =
Table.AddColumn(
YearCol, "Month Name", each Date.MonthName([Date], type
text
),
YearMonthCol =
Table.AddColumn(
MonthNameCol, "Year-Mo", each Text.From([Year]) & "-" & [Month Name], type text
),
MonthNumberCol =
Table.AddColumn(
YearMonthCol, "Month Number", each Date.Month([Date]), Int64.Type
),
WeekdayNameCol =
Table.AddColumn(
MonthNumberCol, "Weekeday", each Date.DayOfWeekName([Date])
),
DayNumberofWeekCol =
Table.AddColumn(
WeekdayNameCol, "Weekday Number", each Date.EndOfWeek([Date]), Int64.Type
),
YearStatusCol =
Table.AddColumn(YearStatusCol, "Year Status", each if Date.IsInCurrentYear([Date]) = true then "Current Year" else
if [Year] = CurrentYear - 1 then "Prior Year" else "Other Year", type text
),
MonthStatusCol =
Table.AddColumn(YearStatusCol, "Month Status", each if [Year Status] = "Current Year" and [Month Number] = CurrentMonth then "Current Month" else
if [Year] = Date.Year(Date.AddMonths(DateTime.Date(DateTime.LocalNow()),-1)) and [Month Number] = Date.Month(Date.AddMonths(DateTime.Date(DateTime.LocalNow()),-1)) then "Prior Month" else
"Other Month", type text
),
DayInMonthCol =
Table.AddColumn(MonthStatusCol,"Day in Month", each Date.Day([Date])), Int64.Type
),
WeekOfYearCol =
Table.AddColumn(DayInMonthCol,"Week of Year", each Date.WeekOfYear([Date])), Int64.Type
),
WeekOfMonthCol =
Table.AddColumn(WeekOfYearCol,"Week of Month", each Date.WeekOfMonth([Date])), Int64.Type
)

in
WeekOfMonthCol

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @BenTen22 ,

 

At a glance, I can see that at least the last three new columns will fail due to you closing the Table.AddColumn function prematurely. You should remove one of the close brackets after the column formula to allow the type defintion to be an argument within the Table.AddColumn function:

 

BA_Pete_1-1662391371107.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

2 REPLIES 2
BA_Pete
Super User
Super User

Hi @BenTen22 ,

 

At a glance, I can see that at least the last three new columns will fail due to you closing the Table.AddColumn function prematurely. You should remove one of the close brackets after the column formula to allow the type defintion to be an argument within the Table.AddColumn function:

 

BA_Pete_1-1662391371107.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Thankyou Pete, also managed to miss a closing bracket further up. Issue now resolved.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.