Forum Discussion

campelliann's avatar
campelliann
Post Patron
3 years ago
Solved

List.PositionOf > performance than Merge Queries?

Hi there,  As Merges between Tables in Power Query are considerer "bad" for performance, I have been trying to use List.PositionOf to get the index of a key on another table (a little bit like ind...
  • ImkeF's avatar
    3 years ago

    Hi campelliann ,
    you're probably asking that question here because you didn't experience the performance advantage of the solution in that video?

    I know that Power Query can be a bit funny sometimes when it comes to performance, but I would really like to see the data where the method presented in the video is actually faster than a merge. Reason for that is that the lookup- table will be referenced once per each row in the (fact) table while with a merge, it would only be referenced once. To improve performance in that case, one could try using a Table.Buffer on the lookup-table to prohibit multiple referencing. But still then I would be very surprised if the index is actually faster. Because again, with that method you have to reference the lookup table at least twice: Once to retrieve the index and second to retrieve the actual lookup value.
    To my experience, a merge will likely be the fastest operation.
    With exact matches on columns that have unique values in the lookup-table you can speed up performance immensly if you transform that merging column to a key-column like described here: Chris Webb's BI Blog: Improving The Performance Of Aggregation After A Merge In Power BI And Excel Power Query/Get&Transform
    Chris Webb's BI Blog (crossjoin.co.uk)

     

    I would like to see other sources that made you believe that merges slow down performance (in comparison to other methods where you have to lookup data from other tables).

    With regard to aproximate matches, I recommend this method: (3) VLOOKUP-True Equivalent in Power Query with Dynamic Tiers - YouTube