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
proavinash
Helper I
Helper I

FORMAT FUNCTION RETURN WRONG MONTH

FORMAT FUNCTION RETURN WRONG MONTH

 

When i am using this format function result showing "January" which is incorrect because today is 23-Nov-2024, please help anyone has solution,

 

currnetmonth = FORMAT(MONTH(TODAY()),"mmm")

currnetmonth = FORMAT(MONTH(TODAY()),"mmmm")

 

proavinash_0-1732375062341.pngproavinash_1-1732375106260.png

 

2 ACCEPTED SOLUTIONS
xifeng_L
Super User
Super User

Hi @proavinash 

 

Because you have an extra MONTH in your formula, this will return the current month 11, and then FORMAT formats the value 11, so it returns January. Because DAX dates from 1900-1-1, so 11 represents 1900-1-11, so return January.

 

You can try below formula.

 

currnetmonth = FORMAT(TODAY(),"mmmm")

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

View solution in original post

KaeRHa
Frequent Visitor

Hi @proavinash ,

The reply you got from @xifeng_L is very precise, I will just perhaps offer some more illustration and a general recommendation. If you have issues with outputs of nested functions, it's worth seeing what the nested part actually returns.

So all the 'date part' functions like month actually return an integer, which you can see here:

KaeRHa_0-1732454950183.png

However, the format function expects a date so when you pass 11 to format function, it is treated exactly as a date so 11th day since the beginning of DAX internal calendar. You can see a similar behaviour e.g. in Excel: if you format a date as a whole number, you will see the nuber of days which passed since thebeginning of Excel's internal calendar.

 

To avoid this, always pass raw date into format functions like that and result should be as expected:

KaeRHa_1-1732455181745.png

Hope this can help too 🙂

 

View solution in original post

2 REPLIES 2
KaeRHa
Frequent Visitor

Hi @proavinash ,

The reply you got from @xifeng_L is very precise, I will just perhaps offer some more illustration and a general recommendation. If you have issues with outputs of nested functions, it's worth seeing what the nested part actually returns.

So all the 'date part' functions like month actually return an integer, which you can see here:

KaeRHa_0-1732454950183.png

However, the format function expects a date so when you pass 11 to format function, it is treated exactly as a date so 11th day since the beginning of DAX internal calendar. You can see a similar behaviour e.g. in Excel: if you format a date as a whole number, you will see the nuber of days which passed since thebeginning of Excel's internal calendar.

 

To avoid this, always pass raw date into format functions like that and result should be as expected:

KaeRHa_1-1732455181745.png

Hope this can help too 🙂

 

xifeng_L
Super User
Super User

Hi @proavinash 

 

Because you have an extra MONTH in your formula, this will return the current month 11, and then FORMAT formats the value 11, so it returns January. Because DAX dates from 1900-1-1, so 11 represents 1900-1-11, so return January.

 

You can try below formula.

 

currnetmonth = FORMAT(TODAY(),"mmmm")

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

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.