Forum Discussion

AlvinB's avatar
AlvinB
Frequent Visitor
1 year ago
Solved

Too slow performance in querying in each

Hi all, I'm facing to the slow performance in below query in DataFlow: I am trying to calculate the days from the document lodged date until today by excluding weekend & public holidays. I am not ...
  • AlvinB's avatar
    1 year ago

    I am still trying to reduce the performance time and one of my efforts was to separate the calculation logic of weekend and public holidays from queries and it reduced the time to run so far.

    I am not sure why but after I separated the calculation logic to a function and calling that from queries, performance has been enhanced.

    Outstanding = Table.AddColumn(_decided, "DaysUntilToday",
            each (
                if [Lodged_date] = null then 0
                else (
                    fx_calBusinessDays(DateTime.Date([Lodged_date]), _toDate)
                )
            )
        ),

    When I tested with the original code with fully implemented 25 queries, it runs about / more than 2 hours but now it runs about an hour. Thanks.