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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
BImaster159
Frequent Visitor

How to get the month from text?

My column contains dates in this format "Mon Jan 01 07:15:36 2024". Now how do I get the month? I want another column that will contain the word January. I tried the format() thing but its throwing errors FORMAT(MAX(‘table‘[column]),“mm“).

 

Help would be appreciated.

 

1 ACCEPTED SOLUTION
v-jtian-msft
Community Support
Community Support

Hi,@BImaster159.Hello, @lbendlin ,Thank you very much for your help of this issue.Your solution looks great!
Now I want to share another suggestion with you.

I am glad to help you.

According to your description, you want to change the Description of the records within the last one year to another color in order to highlight them?

If I understand you correctly, then you can refer to my solution.

 

Here is the test data I created.


Here is my test Data:

vjtianmsft_0-1716195686875.png



vjtianmsft_1-1716195686896.png

 


Add the following code in the Advanced Editor:

    #"Add Column"=Table.AddColumn(#"Changed Type","Month_Name",each Text.Middle([Date],4,3),type text)

vjtianmsft_0-1716195777944.png

 

vjtianmsft_1-1716195783998.png


Create  a calculate column :Value_Month

vjtianmsft_2-1716195809388.png

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

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-jtian-msft
Community Support
Community Support

Hi,@BImaster159.Hello, @lbendlin ,Thank you very much for your help of this issue.Your solution looks great!
Now I want to share another suggestion with you.

I am glad to help you.

According to your description, you want to change the Description of the records within the last one year to another color in order to highlight them?

If I understand you correctly, then you can refer to my solution.

 

Here is the test data I created.


Here is my test Data:

vjtianmsft_0-1716195686875.png



vjtianmsft_1-1716195686896.png

 


Add the following code in the Advanced Editor:

    #"Add Column"=Table.AddColumn(#"Changed Type","Month_Name",each Text.Middle([Date],4,3),type text)

vjtianmsft_0-1716195777944.png

 

vjtianmsft_1-1716195783998.png


Create  a calculate column :Value_Month

vjtianmsft_2-1716195809388.png

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

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

This fails in DAX:

lbendlin_0-1715775337850.png

You are better off converting your column type to datetime in Power Query, and then use the FORMAT function in DAX as indicated.

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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