Forum Discussion
IanCockcroft
Post Patron
7 years agoFORMAT() returns wrong month
Hi guys, i am trying to return the month name from a date formula for testing I wrote is LASTDATE(calender[PK_Date]) & "-"&FORMAT(MONTH(LASTDATE(calender[PK_Date])),"MMM") LASTDATE(calende...
- 7 years ago
Hello IanCockcroft
You don't actually need to call the month for formatting your date the way want, you can just use
dispPevMnthScenario = FORMAT ( LASTDATE ( calender[PK_Date] ) , "m/d/yyyy-mmm" )
The reason you are seeing Jan in your string is because you used MONTH in your formula.
The MONTH of 2/28/2019 is 2
PowerBI sees numbers as a date so when you format 2 as MMM it converts 2 to a date of 1/1/1900 then gives you the mmm of that date which is Jan. Here is an image showing both:
Anonymous
7 years agoNot applicable
It seems to be a filter issue. DAX doesnt give wrong answers, it sometimes gives suprising answers, but there is always a reason. Can you upload a sample?