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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors