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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors