First Post! Expanding Power BI Capabilities with Programming

Oleg Sklyarsky
3 min readApr 22, 2023

--

Microsoft’s Power BI is a powerful data analytics tool that lets users create interactive dashboards and insightful reports. It is a low-code tool, meaning you can accomplish a lot without needing to know any programming languages. But relying on just point-and-click actions only taps into a fraction of its potential. To build scalable reports, data models, and gain deeper analytical insights, you’ll likely need to dabble in some coding.

A great aspect of Power BI is its ability to use different programming languages for more advanced analytics. In this blog post, we’ll chat about five languages — M, SQL, DAX, Python and R — and discover how they’re used in Power BI.

  1. Let’s begin with M, a language utilized in Power Query. Power Query is a tool that connects and transforms data from various sources before loading it into the Power BI data model. Using Power Query, you can perform data transformation tasks like filtering, removing duplicates, splitting columns, and merging tables. The Power Query editor includes built-in functions for many common tasks, so knowing the syntax isn’t always necessary. However, some advanced scenarios do require coding in M, as not all functions are built in.
  2. SQL is used to retrieve, filter, and manipulate data from relational databases, enabling users to extract specific data before it reaches Power BI. It can perform most of the same functions as M and much more. However, SQL is limited to relational databases, and certain Power BI data connectors, like AWS Redshift, do not support writing custom SQL code. Although SQL isn’t part of Power BI, it’s worth mentioning since performing data transformations at the source typically yields better performance. While M is good at this task, using SQL is often preferable if possible.
  3. DAX is a formula language that enables users to create calculated columns, measures, and intricate calculations within the Power BI data model. With DAX, you can add dynamic logic to your data models, making reports and dashboards more interactive and insightful. It supports time-based calculations, such as year-to-date or month-over-month comparisons, which help to uncover trends and patterns in your data. DAX also allows users to manage and analyze large datasets more effectively by defining complex relationships between tables and creating multi-level hierarchies for data organization.
  4. Python and R — I am grouping Python and R together because they share similarities as external languages that can be integrated with Power BI. Keep in mind that these languages are not embedded in Power BI by default; to use them, you’ll need to enable the corresponding options and install them on your system. Power BI supports the integration of Python and R scripts for data transformations and visualizations. Both languages have powerful libraries for data transformation, data visualization, statistical analysis, and machine learning. Python and R can help overcome some of Power BI’s limitations, and with their vast array of libraries, the possibilities for data analysis are nearly endless.

In this initial post, my goal was to provide a brief introduction to these languages in the context of Power BI. Keep an eye out for future posts, where I will delve deeper into each language and further examine their capabilities with practical real-world examples.

--

--