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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Miss_A
Regular Visitor

if text.length

= Table.AddColumn(#"Renamed Columns", "Custom", each if Text.Length[MonthYear]=6 then "0"&[MonthYear] else [MonthYear])

 

When I write the formula for 1-2023 to 01-2023

 

Expression.Error: We cannot apply field access to the type Function.
Details:
Value=[Function]
Key=MonthYear

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Miss_A 

This method should work for you.

Date.ToText(Date.FromText( "1-" &  [Column1],"en-gb"), "MM-yyyy")

 

Fowmy_0-1703735728463.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

You forgot some parentheses

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ1MjAyVorVATJh7FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [MonthYear = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each if Text.Length([MonthYear])=6 then "0"&[MonthYear] else [MonthYear])
in
    #"Added Custom"
Fowmy
Super User
Super User

@Miss_A 

This method should work for you.

Date.ToText(Date.FromText( "1-" &  [Column1],"en-gb"), "MM-yyyy")

 

Fowmy_0-1703735728463.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.