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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.