Forum Discussion

ChemEnger's avatar
ChemEnger
Advocate V
4 years ago
Solved

VERY Slow Group By

I have a query (from a Power BI Dataflow) with approximately 14000 rows.  The Primary key ([Parent], Int64.Type) can have multiple records ([Batch Number], type text) associated with it.  I need to c...
  • ChemEnger's avatar
    4 years ago

    SOLVED.

     

    The speed (or lack thereof) was due to a previous step in the query - I was filtering the the first part of the [Batch Number] field against a list of known [Batch Prefix]s.  What was happening (obvious now!) was that the call was being made to this list multiple times.  A List.Buffer wrapper therefore solved it in one go!

     

    //Buffer the list of Batch Prefixes to prevent multiple calls
    #"Batch Prefixes" = List.Buffer(#"Prefixes"[Batch Prefix]),
    //Select only rows with batch prefixes that match the [Batch Number] Prefix
    #"Filter for Known Batches" = Table.SelectRows(#"Table with Batch Prefixes", each List.Contains(#"Batch Prefixes", [Batch Prefix])),

     

    One point to note is that I did try to create a list query of the Batch Prefixes up front and reference that but got a Formula.Firewall error, hence creating the list from a table within this query (#"Prefixes"[Batch Prefix])