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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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