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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Token EOF Error

I am getting a token eof error on this query and I am not sure why. The week variable prints 26 when I run this with out the database part.

 

let
week = Date.WeekOfYear(DateTime.LocalNow())
in
week
let
Source = Odbc.DataSource("dsn=SystemDSN_ELK_PROD", [HierarchicalNavigation=true]),
gsec_Database = Source{[Name="gsec",Kind="Database"]}[Data],
#"data-resilient_Table" = gsec_Database{[Name="data-resilient-all-2020week",Kind="Table"]}[Data]
in
#"data-resilient_Table"

1 ACCEPTED SOLUTION

Now what will your query do on Jan 1st 2021? 🙂

View solution in original post

10 REPLIES 10
lbendlin
Super User
Super User

were you planning to use the week in the calculation further below?

 

power query can only return one result - you asked it to return two.

Anonymous
Not applicable

OK- I need to use the weeknumber in the table name. I knocked it down and now I get this:

DataSource.Error: The table has no visible columns and cannot be queried.
Details:
data-resilient-all-2020week

Show your new Power Query?

Anonymous
Not applicable

let
week = Date.WeekOfYear(DateTime.LocalNow()),
Source = Odbc.DataSource("dsn=SystemDSN_ELK_PROD", [HierarchicalNavigation=true]),
gsec_Database = Source{[Name="gsec",Kind="Database"]}[Data],
#"data-resilient-all-2020week_Table" = gsec_Database{[Name="data-resilient-all-2020week",Kind="Table"]}[Data]
in
#"data-resilient-all-2020week_Table"

You're still not using the week.  Maybe you wanted to do this?

 

let
week = Date.WeekOfYear(DateTime.LocalNow()),
Source = Odbc.DataSource("dsn=SystemDSN_ELK_PROD", [HierarchicalNavigation=true]),
gsec_Database = Source{[Name="gsec",Kind="Database"]}[Data],
#"data-resilient-all-2020week_Table" = gsec_Database{[Name="data-resilient-all-2020" & week,Kind="Table"]}[Data]
in
#"data-resilient-all-2020week_Table"

Anonymous
Not applicable

warmer, How do I concatentate 2020 and week? It needs to look like data-resilient-all-202026

Expression.Error: We cannot apply operator & to types Text and Number.
Details:
Operator=&
Left=data-resilient-all-2020
Right=26

Anonymous
Not applicable

Welcome to my first day with Power M. This works:

let
week = Date.WeekOfYear(DateTime.LocalNow()),
strWeek = Number.ToText(week),
Source = Odbc.DataSource("dsn=SystemDSN_ELK_PROD", [HierarchicalNavigation=true]),
gsec_Database = Source{[Name="gsec",Kind="Database"]}[Data],
#"data-resilient_Table" = gsec_Database{[Name="data-resilient-all-2020"&strWeek,Kind="Table"]}[Data]
in
#"data-resilient_Table"

Now what will your query do on Jan 1st 2021? 🙂

Anonymous
Not applicable

crash and burn. I think I can figure out the year. we will see.. I wanted to get this working first to minimize the number of problems I had at one time!!

Thanks for your help!

Right, i forgot your week is a number.

 

Which brings up the next question - are weeks 1 to 9 supposed to come over with one digit or two digits? Ie "2"  or "02"  for week 2?

 

Assuming "02"  you would do 

 

Number.ToText(week,"D2")

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Kudoed Authors