GitHub Copilot for data engineers: AI-assisted DAX, M and SQL
João Barros
13 de June de 2025
1 min read
GitHub Copilot is not only for software developers — it is a powerful tool for data engineers and analysts working with DAX, Power Query M, T-SQL and Python in VS Code.
Set up for data
// Recommended VS Code extensions with GitHub Copilot:
// - DAX Formatter
// - Power Query / M Language
// - SQL Server (mssql)
// - Python (ms-python)
// Copilot reads the context of all open tabs — open related files
DAX with Copilot
// Write the comment and Copilot completes:
// Measure: current month sales compared to the same month last year
Sales YoY% =
// [Copilot automatically suggests the SAMEPERIODLASTYEAR formula]
Power Query M with Copilot
// Write what you need as a comment
// Normalize the "Country" column: trim, uppercase, replace PT abbreviations → Portugal
let
// Copilot completes the transformation steps
Source = ...,
T-SQL with Copilot
-- Query to find the top 5 customers by revenue in each region
-- with percentage variation vs the previous quarter
-- Copilot generates the full block with CTEs and window functions
Effective prompting techniques
- Be specific in comments — "calculate YoY growth in %" is better than "compare sales".
- Keep context open — open the existing measures file so Copilot mimics the style.
- Use Copilot Chat for refactoring — select code and ask "optimize this query for SQL Server 2019".
- Iterate — partially accept the suggestion and keep describing what is missing.
Conclusion
GitHub Copilot cuts the time spent writing repetitive code and helps discover features you did not know. For data, it is especially useful in complex T-SQL, M transformations and DAX measures with time intelligence patterns.