Basic.Months
Simple function to centralize month formats in a model. Returns a standardized month format string that can be consistently applied across all date columns showing month-level data in your data model.
Syntax
DaxLib.FormatString.Basic.Months ( )
Definition
DAX
// Simple function to centralize month formats in a model.
// Main benefit is that if you want to change it, you only have to do it in one place.
//
// Recommended: Use a Tabular Editor Macro to assign this function to the format string of every Month field.
( ) => "yyyy-MM"
-- e.g. Dec 2025 (Abbreviated Month Year)
-- "MMM yyyy"
-- e.g. December 2025 (Full Month Name with Year)
-- "MMMM yyyy"
-- e.g. 12/2025 (Numeric Month/Year)
-- "MM/yyyy"
-- e.g. 2025/12 (Year/Month for Sorting)
-- "yyyy/MM"
-- e.g. 2025 Dec (Year First with Abbreviated Month)
-- "yyyy MMM"
-- e.g. 2025 M12 (Year with 'M' Month Indicator)
-- Note: quad-quotes necessary to avoid "M" being interpreted as a month number
-- "yyyy" & """" & "M" & """" & "MM"
-- e.g. Dec-25 (Abbreviated Month-Year Short)
-- "MMM-yy"
-- e.g. 12-2025 (Month-Year with Dash)
-- "MM-yyyy"
-- e.g. 2025.12 (Year.Month with Dot)
-- "yyyy.MM"
Parameters
This function takes no parameters.
Example
DaxLib.FormatString.Basic.Months ()
Use this function in a measure's formatStringDefinition to apply standardized month formatting.
Related Functions
- Basic.Dates - Standardized date formatting
- Basic.Quarters - Standardized quarter formatting
- Basic.DateTimes - Standardized datetime formatting