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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
sgetgood
New Member

Expression.Error: We cannot convert a value of type Function to type Type.

Hi all,

 

I'm sure it's something obvious but wanted to get a fresh set of eyes. I am getting the error:

 

Expression.Error: We cannot convert a value of type Function to type Type.
Details:
Value=[Function]
Type=[Type]

 

With the below code. I need to convert the Constituent Date Added field to en-GB. This particular formula has worked before so I'm not sure where I'm going wrong.

 

Any thoughts welcome.

 

let
    Source = Csv.Document(File.Contents("Queries for Power BI\constituents.csv"),[Delimiter=",", Columns=10, Encoding=1252, QuoteStyle=QuoteStyle.None]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Constituent ID", type text}, {"Constituent Date Added", type text}, {"Deceased", type text}, {"Deceased Date", type text}, {"Gender", type text}, {"Key Indicator", type text}, {"System Record ID", Int64.Type}, {"Constituent Specific Custom Fields Mosaic Group Description", type text}, {"Constituent Specific Custom Fields Mosaic Type Description", Int64.Type}, {"Constituent Pays Tax?", type text}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Changed Type",{{"Constituent Date Added", each Date.From(DateTimeZone.From(_,"en-US"),"en-GB"), type date}})
in
    #"Changed Type1"

 

1 ACCEPTED SOLUTION

It is caused by the following part

 

{"Constituent Date Added", each Date.From(DateTimeZone.From(_,"en-US"),"en-GB"), type date}

 

 

If you want to convert a column using a custom transformation function, you should use Table.TransformColumns instead. so replace Table.TransformColumnTypes with Table.TransformColumns.

If my answer helped solve your issue, please consider marking it as the accepted solution. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h

View solution in original post

3 REPLIES 3
v-pbandela-msft
Community Support
Community Support

Hi @sgetgood,

Thank you for reaching out in Microsoft Community Forum.

Thank you @Omid_Motamedise   for the helpful response.

As suggested by Omid_Motamedise,  I hope this information was helpful. Please let me know if you have any further questions or you'd like to discuss this further. If this answers your question, please "Accept as Solution" and give it a 'Kudos' so others can find it easily.

Please continue using Microsoft community forum.

Regards,
Pavan.

ZhangKun
Super User
Super User

You are confusing Table.TransformColumns with Table.TransformColumnTypes

#"Changed Type1" = Table.TransformColumns(...

It is caused by the following part

 

{"Constituent Date Added", each Date.From(DateTimeZone.From(_,"en-US"),"en-GB"), type date}

 

 

If you want to convert a column using a custom transformation function, you should use Table.TransformColumns instead. so replace Table.TransformColumnTypes with Table.TransformColumns.

If my answer helped solve your issue, please consider marking it as the accepted solution. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors