Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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"
Solved! Go to 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.
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.
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
10 | |
10 | |
8 | |
7 |