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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vishnugupta_
New Member

FORMAT DAX FUNCTION not working as expected

Month = FORMAT('Calendar'[Month Number],"mmm")
 
This function is mapping month number 1 with "Dec" and all other month numbers (2-12) with "Jan"
 
vishnugupta__0-1676109207723.png

 

vishnugupta__1-1676109246665.png

 

Please suggest possible solutions!
3 REPLIES 3
nchr
Frequent Visitor

Hello, the first argument to FORMAT in your case is an integer representing a date. So, passing "1" actually means 12/31/1899 which is correctly formatted to just "Dec". When "2" is passed to the FORMAT function, it means 1/1/1900 which is correctly formatted to "Jan". 

 

So, the solution here is to pass the whole date to the FORMAT function, not just a part of it.

 

 

FreemanZ
Super User
Super User

hi @vishnugupta_ 

it seems you got data with different locale, or YYYY MM DD format. 

change it in Power Query

https://www.myonlinetraininghub.com/change-type-using-locale-with-power-query

 

 

ValtteriN
Super User
Super User

Hi,

Instead of referencing Monthnumber column you can reference your date column:

e.g. 

Month = FORMAT('Calendar'[Date],"mmm")

ValtteriN_0-1676112063597.png

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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