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

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.

Reply
Anonymous
Not applicable

creating date/calendar table

Hi all, 

need some advice here, i am trying to follow the steps here

https://www.powerobjects.com/blog/2018/12/19/sorting-data-fiscal-year-power-bi/

but got this error: The following syntax error occurred during parsing: Invalid token, Line 3, Offset 10, “.

 

Can anyone advice

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You may need to change the syntax "– 1" to "-1" in your formula in English input format, then it will work well.

 

FYMonthNum = 
VAR FYStartMonth = 4
//Update the fiscal year starting month above *Use number between 1 to 12

RETURN IF ( MONTH ( 'Date'[Date]) >= FYStartMonth,
MONTH ( 'Date'[Date] )- ( FYStartMonth -1 ),
12 + (MONTH ( 'Date'[Date] ) - (FYStartMonth -1 ) ) )

Best Regards,

Amy

 

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

11 REPLIES 11
v-xicai
Community Support
Community Support

Hi @Anonymous  ,

 

Does that make sense? If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

 

Best regards

Amy

v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You may need to change the syntax "– 1" to "-1" in your formula in English input format, then it will work well.

 

FYMonthNum = 
VAR FYStartMonth = 4
//Update the fiscal year starting month above *Use number between 1 to 12

RETURN IF ( MONTH ( 'Date'[Date]) >= FYStartMonth,
MONTH ( 'Date'[Date] )- ( FYStartMonth -1 ),
12 + (MONTH ( 'Date'[Date] ) - (FYStartMonth -1 ) ) )

Best Regards,

Amy

 

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

parry2k
Super User
Super User

@Anonymous I copied the code and it worked, I need to fix the double quotes. Can you copy DAX expression what you are using?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k changed the double quotes and it worked!

how abt step 2? I got error as well

@Anonymous can you share what expression are you using? I have no idea what is step 2.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k 

I copied this code

 

 

FYMonthNum = 

          VAR FYStartMonth = 4

          //Update the fiscal year starting month above *Use number between 1 to 12

          RETURN

IF (

                    MONTH ( 'Date'[Date]) >= FYStartMonth,

                    MONTH ( Date[Date] )

– ( FYStartMonth – 1 ),

12

+ (

                         MONTH ( Date[Date] )

– ( FYStartMonth – 1 )

)

)

 

@Anonymous you are missing single quote

 

FYMonthNum = 

          VAR FYStartMonth = 4

          //Update the fiscal year starting month above *Use number between 1 to 12

          RETURN

IF (
                   MONTH ( 'Date'[Date]) >= FYStartMonth,
                   MONTH ( 'Date'[Date] )
- ( FYStartMonth – 1 ),
12
+ (
                        MONTH ( 'Date'[Date] )
– ( FYStartMonth – 1 )
)

)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k 

Strange, i copied yours and still got error at line 12.

Capture.JPG

there is special character

 

fixed with this

FYMonthNum = 
    VAR FYStartMonth = 4

    //Update the fiscal year starting month above *Use number between 1 to 12
    RETURN
IF (
    MONTH ( 'Date'[Date]) >= FYStartMonth,
    MONTH ( 'Date'[Date] )- ( FYStartMonth – 1 ),
    12 + (MONTH ( 'Date'[Date] ) - (FYStartMonth – 1 )
)
)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k i copied and still get error?

Strange Smiley Embarassed

123.JPG

@Anonymous  
I would recommend manually type the code, it works for me and I don't see any reason why it shouldn't work for you.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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 Solution Authors