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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
MiltonM
New Member

Extract year from date data

I've been trying to use Date.Year to extract yyyy from mm/dd/yyyy, for a few days now. The best thought I have is to convert the date to text and take the last four characters, but I believe there's a better/easier way to solve this.

 

Thank you.

3 ACCEPTED SOLUTIONS

the first parameter of this function should be text, not a date value.

if [order date] is date type,try Text.AfterDelimiter(Text.From([ORDER DATE]),"/",{0,1})

View solution in original post

v-eqin-msft
Community Support
Community Support

Hi @MiltonM ,

 

If the column type is Date, please directly go to Add Column tab--> Date-->Year to extract :

Eyelyn9_2-1641188914951.png

 

 

If the column type is Text, then go to Add Column tab--> Extract --> Last characters:

Eyelyn9_1-1641188876354.png

 

Best Regards,
Eyelyn Qin
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

Anonymous
Not applicable

It knows how to parse dates using the rules of the system's culture.

 

= Table.TransformColumnTypes(Source,{{"Text", type date}}, "en-US")
// verses
= Table.TransformColumnTypes(Source,{{"Text", type date}}, "en-GB")
// or
= Table.TransformColumnTypes(Source,{{"Text", type date}}, "fr")

// your default is
= Culture.Current

 

View solution in original post

10 REPLIES 10
MiltonM
New Member

Thank you, Daniel.

I'm painfully new but begging to catch on.

v-eqin-msft
Community Support
Community Support

Hi @MiltonM ,

 

Sorry for my miss for your solution posted before.

Eyelyn9_0-1641258456043.png

 

 

Please kindly Accept it as the solution. More people will benefit from it.😀

 

Best Regards,
Eyelyn Qin

v-eqin-msft
Community Support
Community Support

Hi @MiltonM ,

 

If the column type is Date, please directly go to Add Column tab--> Date-->Year to extract :

Eyelyn9_2-1641188914951.png

 

 

If the column type is Text, then go to Add Column tab--> Extract --> Last characters:

Eyelyn9_1-1641188876354.png

 

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

MiltonM
New Member

Oh, WOW! I've been making it way too hard all this time.

1) select data column

2) Date icon, select year, select year. DONE!

 

I see now there are many ways to get the result we're seeking, but thanfully this was a "built-in" option.

 

Thanks to your both. I love this group and shall return.

Anonymous
Not applicable

It knows how to parse dates using the rules of the system's culture.

 

= Table.TransformColumnTypes(Source,{{"Text", type date}}, "en-US")
// verses
= Table.TransformColumnTypes(Source,{{"Text", type date}}, "en-GB")
// or
= Table.TransformColumnTypes(Source,{{"Text", type date}}, "fr")

// your default is
= Culture.Current

 

smpa01
Super User
Super User

@MiltonM  Split on right most delimiter, which will be the YEAR

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

That sounds logical; however, I am pretty new and don't know how to split or determine the rightmost delimiter. Of I go to search, the game is afoot.

Text.AfterDelimiter(text,"/",{0,1})

Daniel,

I just tried =Text.AfterDelimiter([ORDER DATE],"/",{0,1}), it failed.

 

the first parameter of this function should be text, not a date value.

if [order date] is date type,try Text.AfterDelimiter(Text.From([ORDER DATE]),"/",{0,1})

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

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.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

Top Solution Authors
Top Kudoed Authors