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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

EOF TOKEN EXPECTED WARNING in DAX FORMULA

FiscalMonthStartDate =
VAR CalendarYear = YEAR('Calendar'[Date])
VAR FiscalYearStartMonth = 8
RETURN
IF(
MONTH('Calendar'[Date]) >= FiscalYearStartMonth,
DATE(CalendarYear, MONTH('Calendar'[Date]) - 7, 1),
DATE(CalendarYear - 1, MONTH('Calendar'[Date]) + (12 - FiscalYearStartMonth + 1), 1)
)
Hi,
I am trying to write a formula like that but I get a eof token expected warning. How can I solve that? Thank you.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

If you create a calculated column, this dax outputs as expected.

vtangjiemsft_2-1695951146340.png

 

If you create a measure, modify the dax as follows:

Measure_FiscalMonthStartDate = 
VAR CalendarYear = YEAR(MAX('Calendar'[Date]))
VAR FiscalYearStartMonth = 8
RETURN
IF(
MONTH(MAX('Calendar'[Date])) >= FiscalYearStartMonth,
DATE(CalendarYear, MONTH(MAX('Calendar'[Date])) - 7, 1),
DATE(CalendarYear - 1, MONTH(MAX('Calendar'[Date])) + (12 - FiscalYearStartMonth + 1), 1)
)

vtangjiemsft_1-1695951104243.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

 

If you create a calculated column, this dax outputs as expected.

vtangjiemsft_2-1695951146340.png

 

If you create a measure, modify the dax as follows:

Measure_FiscalMonthStartDate = 
VAR CalendarYear = YEAR(MAX('Calendar'[Date]))
VAR FiscalYearStartMonth = 8
RETURN
IF(
MONTH(MAX('Calendar'[Date])) >= FiscalYearStartMonth,
DATE(CalendarYear, MONTH(MAX('Calendar'[Date])) - 7, 1),
DATE(CalendarYear - 1, MONTH(MAX('Calendar'[Date])) + (12 - FiscalYearStartMonth + 1), 1)
)

vtangjiemsft_1-1695951104243.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.