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
dadelta50
Regular Visitor

Month name to month number

I have a file with 2 columns - Month & Year.  The month column contains the month name only (Oct).

I would like to convert the month name to the month number but have not found any way to do this.

Any help would be greatly appreciated. Thank you.

1 ACCEPTED SOLUTION
Thejeswar
Resident Rockstar
Resident Rockstar

@dadelta50,

Use an IF ELSE or SWITCH Statement. Example shown below

 

 

MonthNo = SWITCH('Year - Month'[Month], 
        "Jan", 1,
        "Feb",2,
        "Mar",3,
        "Apr",4,
        "May",5,
        "Jun",6,
        "Jul",7, 
        "Aug",8,
        "Sep",9,
        "Oct",10,
        "Nov",11,
        "Dec",12
                )

 

'Year - Month'[Month] has the Month Names in it

View solution in original post

2 REPLIES 2
lan_duoduo
New Member

Hi, 

if you have a date format column like '01/01/2023' then maybe try

Month number = FORMAT('Calendar Table'[Reporting Month], "m")
Thejeswar
Resident Rockstar
Resident Rockstar

@dadelta50,

Use an IF ELSE or SWITCH Statement. Example shown below

 

 

MonthNo = SWITCH('Year - Month'[Month], 
        "Jan", 1,
        "Feb",2,
        "Mar",3,
        "Apr",4,
        "May",5,
        "Jun",6,
        "Jul",7, 
        "Aug",8,
        "Sep",9,
        "Oct",10,
        "Nov",11,
        "Dec",12
                )

 

'Year - Month'[Month] has the Month Names in it

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.