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
hemingt
Helper V
Helper V

How to get the last two digits of the current year

Hi Team,

 

I use the M language  Date.WeekOfYear(Date.From(DateTime.LocalNow()), Day.Monday) to get to the current week number, the value is 14 for today. But I want to get as 1914, is it possible?

if no, I think I can get the last two digits of the year, such as 2019, to get 19,  do you know how to do with M language?

Thank you!

1 ACCEPTED SOLUTION
PattemManohar
Community Champion
Community Champion

@hemingt  Please try this as a Custom Column in Power Query to get the last two digits of the current year or any date field from the table.

 

=Text.End(Date.ToText(DateTime.Date(DateTime.LocalNow())),2)

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

2 REPLIES 2
PattemManohar
Community Champion
Community Champion

@hemingt  Please try this as a Custom Column in Power Query to get the last two digits of the current year or any date field from the table.

 

=Text.End(Date.ToText(DateTime.Date(DateTime.LocalNow())),2)

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Thank you @PattemManohar 

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.