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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
andywil456
Advocate II
Advocate II

formating month

I have created a calendar table, but when i create a month column with a format, it only gives months of January or December.  For example i'm getting Feb to June dates returning a month value of January.

 

The code i'm using is Date = ADDCOLUMNS(CALENDAR("01-Jan-2015","31-12-2017"),"DATEASINTEGER",FORMAT([Date],"DD/MM/YY"),"Year",YEAR([Date]),"MONTH & YEAR",FORMAT([Date],"MMM YYYY")," EOMONTH",FORMAT(EOMONTH([Date],0),"MMMM"),"END OF MONTH",FORMAT(EOMONTH([Date],0),"MMMM/YYYY"),"MONTH",FORMAT(MONTH([Date]),"MMM"))

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

You don't need to nest any date component formulas inside a FORMAT formula in order to get a single component like month. FORMAT(DateTable[Date], "MMM") should give you what you're looking for.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

You don't need to nest any date component formulas inside a FORMAT formula in order to get a single component like month. FORMAT(DateTable[Date], "MMM") should give you what you're looking for.

Thanks KHorseman, Works a treat.

 

Sean
Community Champion
Community Champion

@Anonymous is lightning fast - so I'll just post a slightly more readable version of @andywil456's formula

 

EDIT: Now with MONTHSORT column

 

Date =
ADDCOLUMNS (
    CALENDAR ( "01-Jan-2015", "31-12-2017" ),
    "DATEASINTEGER", FORMAT ( [Date], "DD/MM/YY" ),
    "Year", YEAR ( [Date] ),
    "MONTH & YEAR", FORMAT ( [Date], "MMM YYYY" ),
    "EOMONTH", FORMAT ( EOMONTH ( [Date], 0 ), "MMMM" ),
    "END OF MONTH", FORMAT ( EOMONTH ( [Date], 0 ), "MMMM/YYYY" ),
    "MONTH", FORMAT ( [Date], "MMM" ),
    "MONTHSORT", INT ( FORMAT ( [Date], "yyyyMM" ) )
)

 

Anonymous
Not applicable

quicksilver.jpg

 

@Sean very good. While you're at it might as well add a sort order for the Month & Year column

 

"MonthSort", INT(FORMAT([Date], "yyyyMM"))

Sean
Community Champion
Community Champion

Well not that fast! Smiley LOL

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.