Expression.Error: We cannot convert the value “null” to type Logical.

The Expression.Error: We cannot convert the value "null" to type Logical error halts data processing when the Power Query engine runs an operation that demands a strict true or false answer, but runs into an empty cell (null) instead. Because the data engine refuses to guess how to handle missing records, it stops evaluation immediately. Resolving this logic break is essential for ensuring that row filtering, conditional transformations, and automated reporting systems remain operational during data refreshes.

Fast-Fix: The 45-Second Solution

This error triggers when a row filter, conditional column, or custom M-code statement evaluates a column containing blank or empty values (null) where a boolean value (true or false) is strictly required. To fix it, adjust your logic step to explicitly handle blanks by using code like if [Column] = null then false else [Column], or replace the null values with false before running the logical test.

Quick Risk Snapshot

  • Severity Tier: Moderate
  • Is it safe to ignore? No. This error stops your query from loading or refreshing completely, meaning downstream Excel tables or data models will fail to display any updated information.
  • Most Common Cause: Using a column with empty or blank cells directly as a filter criterion or inside a conditional column step without a null check.
  • Rare/Serious Cause: Nested JSON or web API responses returning incomplete records that break dynamic schema validation loops.

Low Risk vs. High Risk

  • If the error occurs in an optional tracking column used only for visual tags: This is Low Risk. The data integrity of your core business numbers remains intact, and the fix requires only a minor cleaning step to assign a default state to the blank cells.
  • If the logical check governs rows filtered for financial calculations, system access logs, or data security models: This is High Risk. When the engine hits a null row, it drops execution entirely. If users try to sweep this under the rug using broad error-skipping tools, entire chunks of transaction data can silently disappear from the output table.

The Mechanics of the Break

Power Query’s evaluation engine uses a strict approach to typing. Think of a logical step like an automated sorting gate on a high-speed conveyor belt. The gate is mechanical and has only two settings: swing left for true, or swing right for false. It cannot pause or remain in the middle.

When you configure a row filter step, the underlying M-code uses a function like this to check every single row:

Table.SelectRows(Source, each [IsPrioritized])

If the IsPrioritized column contains clean boolean records, the gate operates seamlessly. However, if row 542 is completely empty, the engine pulls a value of null. The sorting gate receives a missing instruction instead of an explicit left or right command. Unlike standard Excel formulas, which often evaluate blank cells as zero or false, Power Query refuses to make assumptions about what the blank represents. It jams instantly, halts the assembly line, and errors out with a conversion exception because it cannot turn nothingness into a logical decision.

Probability Breakdown

When checking why your logical expressions are breaking down on refresh, look into these common layout vulnerabilities:

  • Likely (70%): Filtering rows based on a true/false column where data entry operators left some rows blank or omitted checkboxes entirely in the source table.
  • Possible (20%): A custom conditional column statement (if [Status] = "Complete" then true else null) that passes a raw null down to a later step that expects strict logical types.
  • Rare (10%): Corrupt database migrations where binary flags are translated incorrectly into text arrays or unhandled nested objects.

What Escalates the Risk

The threat of an unexpected query crash increases based on how your data source expands over time:

  1. Deeply Buried Errors: Power Query evaluates only the first 1,000 rows when you are working inside the visual editor interface. If your data entry blanks occur on row 5,000, your query will look completely clean during development but will crash in production when running a full data refresh.
  2. Unvetted Upstream Forms: Using web forms or data collection sheets that allow users to submit rows without filling out mandatory yes/no toggles guarantees that null entries will eventually flood your data ingestion pipeline.
  3. Chained Query Layers: If multiple advanced tables refer back to the broken query, a single logical failure at the root will trigger a cascade of errors across your entire data architecture.

Consequence Timeline

  • 24 Hours: Immediate refresh breakdown. Scheduled dashboards and corporate trackers stop loading new information, leaving users with stale data.
  • 1 Week: Work disruption. Because the query is non-functional, business teams resort to manual data entry workarounds, copying source records directly into standalone sheets and creating duplicate records.
  • 1 Month: Data architecture abandonment. If left uncorrected, the automated query pipeline is often abandoned completely due to poor reliability, driving up maintenance overhead as developers have to rebuild reporting loops from scratch.

Common Confusion Fix

It is important to contrast a boolean conversion failure from other data conversion errors:

What To Do Right Now

If your data refresh is currently stuck on this conversion error, execute these initial containment steps:

  1. Isolate the Step: Look at the Applied Steps panel on the right side of your Power Query window. Find the step marked with a warning icon, usually a “Filtered Rows” or “Added Conditional Column” step.
  2. View the Prior State: Click on the step directly above the broken transformation step to examine the clean data column before the crash occurs.
  3. Identify the Blanks: Click the drop-down filter arrow on the column header causing the issue, scroll down to check the data profile, and look for a (blank) or null listing to verify where the empty records reside.

Hard-Stop Triggers

Do not attempt a quick data type patch if you encounter these technical issues:

  • The column contains random mixtures of text (like “Yes”, “No”, “Maybe”, and “N/A”) alongside true boolean records. Forcing a logical type conversion onto unstructured text strings will cause widespread data corruption.
  • The error occurs within a complex, encrypted custom M-code function module that interfaces with an external enterprise database API.

Professional Audit Path

To resolve a logical null error permanently, follow this diagnostic checklist inside the Power Query editor:

Step 1: Repair via the User Interface (Pre-Filter Cleaning)

Before the step that throws the error, select the target true/false column. Right-click the header, choose Replace Values…, type null in the Value To Find box, and enter false in the Replace With input. This sweeps the column clean and ensures the sorting gate receives a clear command for every single row.

Step 2: Repair via the Advanced Editor (M-Code Logic Hardening)

If the error occurs inside a custom code filter or conditional column, open the Advanced Editor and locate your logical statement. Look for raw comparisons that ignore blanks. Adjust your code to explicitly handle the null state using an explicit conditional statement:

// Avoid this: each [IsActive]
// Use this instead:
Table.SelectRows(Source, each [IsActive] <> null and [IsActive])

Alternatively, if you are writing a standard conditional statement, ensure your logic contains a fallback:

if [IsActive] = null then false else [IsActive]

Step 3: Run Validation Profiling

Turn on data profiling by checking Column Quality and Column Profile on the View tab of the ribbon. Verify that your target column reports 100% valid records with 0% errors before saving your query changes.

Complexity/Repair Range

  • Classification: Minor (Logic)
  • Primary Effort Drivers: The layout and origin of your data stream. If the issue is caused by empty cells in a standard spreadsheet column, the fix takes two minutes using the built-in Replace Values option. If the break occurs within a nested database loop, you will need to open the Advanced Editor to manually adjust your statement sequences.

Symptom Escalators

When patching logic gates, applying hasty fixes like clicking “Remove Errors” on the column header can sometimes filter out valid rows and warp your reporting metrics. To see how to manage row-level errors safely without corrupting your data volume, review the comparisons in How to use “Remove Errors” vs. “Replace Errors” in the PQ Interface.

Diagnostic Summary

The Expression.Error concerning logical nulls is simply a strict type enforcement check by Power Query’s data engine. By cleaning up empty cells or hardening your M-code filters to handle missing inputs explicitly, you eliminate the sorting bottleneck. This stabilizes your data pipeline and ensures your automated workbooks refresh perfectly every time.