Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
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()
)
)
Solved! Go to Solution.
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.
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 53 | |
| 47 | |
| 30 | |
| 15 | |
| 14 |
| User | Count |
|---|---|
| 88 | |
| 73 | |
| 38 | |
| 26 | |
| 25 |