Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.