Basics

M Introduction

Introduction to M Power Query Language

M is the query language for Power BI and Excel transforming data.

What is M Language?

M is a powerful query language used primarily in Microsoft Power BI and Excel. It is designed to transform and manipulate data, allowing users to extract, cleanse, and shape their data with ease. M is a functional language which means it emphasizes the application of functions and avoids changing-state and mutable data.

Key Features of M

  • Function-Based: M is a functional language that relies heavily on functions for processing data.
  • Case Sensitive: M is case-sensitive, so keywords and identifiers must be used with the correct capitalization.
  • Data Transformation: Provides powerful tools for data extraction and transformation.
  • Integration with Excel and Power BI: Seamlessly integrates with these tools for enhanced data analysis.

Basic Syntax of M

The syntax of M is designed for simplicity and ease of use. Here is a simple example of an M query:

In this example:

  • let is used to define variables and expressions.
  • Source extracts data from an Excel table named "Table1".
  • FilteredRows filters out rows where Column1's value is greater than 10.
  • Result transforms Column2 by multiplying each value by 2.

How M Works in Power BI and Excel

Within Power BI and Excel, M is used in the Query Editor to load, transform, and prepare data for analysis. You can write M scripts manually or use the Query Editor's graphical interface, which automatically generates M code as you perform actions.

Conclusion

M is an essential tool for anyone working with Power BI and Excel who needs to perform complex data transformations. Its function-based approach and seamless integration with Microsoft tools make it a powerful choice for data professionals.

Next
Setup