Forum Discussion
KennIpsen
8 years agoFrequent Visitor
PQ: Invoking custom function suddenly stopped working
I have a query that has been running weekly for several months and that suddenly has stopped working. This part of the data model basically consists of getting a file(/sheet) list from Excel files i...
- 8 years ago
Hi KennIpsen,
Based on my test, I cannot reproduce your issue here following your steps. Here is my code for your reference. Could you please share your excel file to me if possible? Also you can check the blog to have a try of that way.
(fName, sName) => let Source = Excel.Workbook(File.Contents(fName), null, true), Sheet1_Sheet = Source{[Item=sName,Kind="Sheet"]}[Data], #"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]), #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", type date}, {"cat", type text}, {"Sales", Int64.Type}}), #"Removed Top Rows" = Table.Skip(#"Changed Type",1), #"Filled Up" = Table.FillUp(#"Removed Top Rows",{"Date"}), #"Filtered Rows" = Table.SelectRows(#"Filled Up", each ([cat] <> "VS")), #"Promoted Headers1" = Table.PromoteHeaders(#"Filtered Rows", [PromoteAllScalars=true]), #"Renamed Columns" = Table.RenameColumns(#"Promoted Headers1",{{"1/2/2018", "1"}}), #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Renamed Columns", {"1"}, "Attribute", "Value"), #"Renamed Columns1" = Table.RenameColumns(#"Unpivoted Other Columns",{{"Attribute", "2"}}), #"Pivoted Column" = Table.Pivot(#"Renamed Columns1", List.Distinct(#"Renamed Columns1"[#"2"]), "2", "1", List.Count) in #"Pivoted Column"Regards,
Frank
v-frfei-msft
8 years agoCommunity Support
Hi KennIpsen,
Based on my test, I cannot reproduce your issue here following your steps. Here is my code for your reference. Could you please share your excel file to me if possible? Also you can check the blog to have a try of that way.
(fName, sName) =>
let
Source = Excel.Workbook(File.Contents(fName), null, true),
Sheet1_Sheet = Source{[Item=sName,Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", type date}, {"cat", type text}, {"Sales", Int64.Type}}),
#"Removed Top Rows" = Table.Skip(#"Changed Type",1),
#"Filled Up" = Table.FillUp(#"Removed Top Rows",{"Date"}),
#"Filtered Rows" = Table.SelectRows(#"Filled Up", each ([cat] <> "VS")),
#"Promoted Headers1" = Table.PromoteHeaders(#"Filtered Rows", [PromoteAllScalars=true]),
#"Renamed Columns" = Table.RenameColumns(#"Promoted Headers1",{{"1/2/2018", "1"}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Renamed Columns", {"1"}, "Attribute", "Value"),
#"Renamed Columns1" = Table.RenameColumns(#"Unpivoted Other Columns",{{"Attribute", "2"}}),
#"Pivoted Column" = Table.Pivot(#"Renamed Columns1", List.Distinct(#"Renamed Columns1"[#"2"]), "2", "1", List.Count)
in
#"Pivoted Column"
Regards,
Frank
KennIpsen
8 years agoFrequent Visitor
Thansk for the reply, i found out that it wasn't the code causing the problem, but the excel sheet.
Thanks for confirming this to me though.
There was a bad reference within the datasource
best regards
Kenn