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
Anonymous
Not applicable

Creating a Date from Source Name

Currently combining multiple excel docs with the date in the name of the excel file

 

eg: 2018 Capex Projects - February Forcast.xlsx

 

Would like to make a column that can be used to identify the date from the above example as 02/2018, is there a funtion that i can use that will help do this?

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@Anonymous,

Create the following columns in your table.

Month = if(search("january",[Source.Name],1,0)>0,01,if(search("february",[Source.Name],1,0)>0,02,if(search("march",[Source.Name],1,0)>0,03,if(search("april",[Source.Name],1,0)>0,04,if(search("may",[Source.Name],1,0)>0,05,if(search("june",[Source.Name],1,0)>0,06,if(search("july",[Source.Name],1,0)>0,07,if(search("august",[Source.Name],1,0)>0,08,if(search("september",[Source.Name],1,0)>0,09,if(search("october",[Source.Name],1,0)>0,10,if(search("november",[Source.Name],1,0)>0,11,if(search("December",[Source.Name],1,0)>0,12))))))))))))
Year = LEFT([Source.Name],4)
YearMonth = [Month]&"/"&[Year]

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
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-yuezhe-msft
Employee
Employee

@Anonymous,

Create the following columns in your table.

Month = if(search("january",[Source.Name],1,0)>0,01,if(search("february",[Source.Name],1,0)>0,02,if(search("march",[Source.Name],1,0)>0,03,if(search("april",[Source.Name],1,0)>0,04,if(search("may",[Source.Name],1,0)>0,05,if(search("june",[Source.Name],1,0)>0,06,if(search("july",[Source.Name],1,0)>0,07,if(search("august",[Source.Name],1,0)>0,08,if(search("september",[Source.Name],1,0)>0,09,if(search("october",[Source.Name],1,0)>0,10,if(search("november",[Source.Name],1,0)>0,11,if(search("December",[Source.Name],1,0)>0,12))))))))))))
Year = LEFT([Source.Name],4)
YearMonth = [Month]&"/"&[Year]

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

in excel, i know this might be a cluncky formula, but i would use something like this to identify the month:

 

if(isnumber(search("january",[Source.Name])),01,null)if(isnumber(search("february",[Source.Name])),02,if(isnumber(search("march",[Source.Name])),03,if(isnumber(search("april",[Source.Name])),04,if(isnumber(search("may",[Source.Name])),05,if(isnumber(search("june",[Source.Name])),06,if(isnumber(search("july",[Source.Name])),07,if(isnumber(search("august",[Source.Name])),08,if(isnumber(search("september",[Source.Name])),09,if(isnumber(search("october",[Source.Name])),10,if(isnumber(search("november",[Source.Name])),11,if(isnumber(search("december",[Source.Name])),12,NULL))

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.

Top Solution Authors
Top Kudoed Authors