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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
aman_sinha
New Member

DAX - Token Eof expected error.

I am trying to add a custom column using the following DAX Code. I keep getting the error "Token Eof expected" around the first line - "....StartDate =". Please help.

VAR StartDate =
DATE(
YEAR([Completion time])
- IF(MONTH([Completion time]) < 8, 1, 0),
8,
1
)

VAR Block1End = StartDate + 9 * 7
VAR Block2End = Block1End + 10 * 7
VAR Block3End = Block2End + 9 * 7
VAR Block4End = Block3End + 10 * 7

RETURN
IF(
CONTAINSSTRING([Select your class:], "First Year"),

SWITCH(
TRUE(),
[Completion time] >= StartDate
&& [Completion time] < Block1End, "Block 1",
[Completion time] < Block2End, "Block 2",
[Completion time] < Block3End, "Block 3",
[Completion time] < Block4End, "Block 4",
BLANK()
),

SWITCH(
TRUE(),
[Completion time] >= StartDate
&& [Completion time] < Block1End, "Block 5",
[Completion time] < Block2End, "Block 6",
[Completion time] < Block3End, "Block 7",
[Completion time] < Block4End, "Block 8",
BLANK()
)
)

1 ACCEPTED SOLUTION
Irwan
Super User
Super User

hello @aman_sinha 

 

do you mean "custom column" in Power Query?

if yes, then you will most likely get error since Power Query accepts M and doesnt accept DAX.

Hope this will help.

Thank you.

View solution in original post

1 REPLY 1
Irwan
Super User
Super User

hello @aman_sinha 

 

do you mean "custom column" in Power Query?

if yes, then you will most likely get error since Power Query accepts M and doesnt accept DAX.

Hope this will help.

Thank you.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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