Forum Discussion

ahmedshalabyy12's avatar
1 year ago
Solved

Query folding

Dears,   How i can verify that my query is folded  that's the query : let // Define your start and end range RangeStart = #datetime(2025, 8, 1, 0, 0, 0), RangeEnd = #datetime(2025, 8, 10, 0,...
  • rohit1991's avatar
    1 year ago

    Hi ahmedshalabyy12 

    How to verify your query is folded (Databricks + Value.NativeQuery):

    1. Value.NativeQuery already sends SQL to Databricks. Folding only matters for steps after that step.

    2. In Power Query, right-click the last step >> View Native Query.

      • Clickable = still folded to SQL.

      • Greyed out = folding broke earlier.

    3. Do a quick litmus test: add Keep Top Rows >> 5 (or filter a date). Recheck View Native Query.

      • If you see LIMIT 5 (or your WHERE clause) in the SQL, it’s folded.

    4. Cross-check in Databricks >> SQL >> Query History while preview/refresh runs.

      • Your server log should show the final SQL with your filters. If it shows SELECT * and filters aren’t there, they were applied locally.

    5. Remember: many steps break folding (e.g., Table.Buffer, custom M, merges with non-foldable sources). Put them after you’ve narrowed data.