Power Query Problems

How to Use the Hash Symbol and Each Keyword in Power Query M

Huma Ashraf ChHuma Ashraf Ch Nov 3, 2026 869 views

Question details

The user wants to understand the purpose and correct usage of the hash symbol (#) and the 'each' keyword within the Power Query M formula language.

Understanding the Hash Symbol and Each Keyword in Power Query M
Product
Power Query
Device & OS
not provided
Scenario
Writing or troubleshooting M code in the Advanced Editor, creating custom columns, or renaming query steps.
Observed behavior
Seeking clarification on when the hash symbol is required for identifiers and built-in functions, and how the 'each' keyword processes table rows.
Before you start

Open the Advanced Editor in your Power Query window to view the raw M code. This will allow you to see exactly where the hash symbol and 'each' keywords are currently being applied in your data transformation steps.

Solution 1Recommended

Using the Hash Symbol (#) for Identifiers and Functions

The hash symbol is required in Power Query M to reference step names containing spaces or special characters, as well as to call specific built-in intrinsic values.

In Power Query M, variables and step names cannot normally contain spaces. The hash symbol, combined with double quotes, acts as an escape sequence that allows spaces and special characters inside step identifiers.

1
Reference step names with spaces

If your applied step name has spaces (e.g., Added Custom), you must format it with a hash and quotes. In the Advanced Editor, reference it as #"Added Custom".

2
Reference step names without spaces

For step names without spaces (e.g., CustomStep1), the hash symbol and quotes are not strictly necessary. You can refer to the step simply by its name, though the Advanced Editor often auto-generates them anyway.

3
Use built-in intrinsic functions

Use the hash symbol to call specific M language intrinsic values. Common examples include #datetime, #date, #table, and #shared. For instance, to define a date, use #date(2023, 10, 1).

Auto-generation: When you rename a step in the 'Applied Steps' pane, Power Query automatically updates the M code and applies the #"..." syntax if you included spaces.
Free Microsoft Office alternative

Use WPS Office for Streamlined Data Analysis

While Power Query M is specific to Microsoft's ecosystem, WPS Office provides a lightweight, highly compatible, and free alternative for complex data processing, pivot tables, and data visualization. It supports standard Excel formats seamlessly without the heavy system requirements.

  1. 1. Download WPS Office: Visit the official WPS website and download the free WPS Office suite for your operating system.
  2. 2. Install and Launch: Follow the simple installation wizard, then open WPS Spreadsheet.
  3. 3. Open your files: Drag and drop your existing .xlsx workbooks into WPS Spreadsheet to continue your data analysis without losing any formatting.
100% compatible with Microsoft Excel formats (.xlsx, .xls, .csv)Built-in advanced data analysis tools and PivotTablesLightweight application that runs smoothly even on older devicesFamiliar user interface with zero learning curve
microsoft office alternative - wps office

Frequently Asked Questions

Why do some Power Query step names have a hash symbol and quotes while others do not?

Step names that contain spaces or special characters require the hash symbol and double quotes (e.g., #"Filtered Rows") so the M engine can correctly parse the identifier as a single entity. Single-word step names without special characters do not strictly require this syntax.

Can I use the 'each' keyword without the underscore (_) symbol?

Yes. When you reference columns within an 'each' statement (like 'each [ColumnName]'), the underscore is implicitly understood as the current row record. You only need to explicitly write the underscore if you are passing the entire row record to another function.

What does #shared mean in Power Query?

#shared is a special intrinsic record in the Power Query M language that returns a list of all the functions, variables, and enumerations currently available in your environment. It is an excellent tool for exploring built-in M functions directly in the editor.