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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors