Forum Discussion

KennIpsen's avatar
KennIpsen
Frequent Visitor
8 years ago
Solved

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...
  • v-frfei-msft's avatar
    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