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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Microsoft Employee
Microsoft 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
Microsoft Employee
Microsoft 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors