Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
NithyaKB
Helper I
Helper I

Power Query - Replacing empty cells in source with null in M query

Hi,
I have a table in which say for example in  a table column title  has empty values for few rows .I am expanding my table in Power query and fetching only the title column.For few rows it is showing as error .I tried replacing errors with null however it worked but it is taking longer time . Is there anyway where I can check in if the table has empty rows then replace that with null else the values in title column for each row.


M query: 
let
Source = SharePoint.Tables("sharepoint site url",
#" " = Source{[Id=" "]}[Items],
#"Renamed Columns" = Table.RenameColumns(#" ",{{"ID", "ID.1"}}),
#"Removed Other Columns" = Table.SelectColumns(#"Renamed Columns",{"Id", "Title", "Modified", "Created"),
#"Expanded Author" = Table.ExpandRecordColumn(#"Removed Other Columns", "Author", {"Title"}, {"Author.Title"}),
#"Renamed Columns1" = Table.RenameColumns(#"Expanded Author",{{"Author.Title", "Author"}}),
#"Expanded Handler" = Table.ExpandRecordColumn(#"Renamed Columns1", "Handler", {"Title"}, {"Handler.Title"}),
#"Renamed Columns2" = Table.RenameColumns(#"Expanded Handler",{{"Handler.Title", "Handler"}}),
#"Expanded Assigned" = Table.ExpandRecordColumn(#"Renamed Columns2", "Assigned", {"Title"}, {"Assigned.Title"})
in
#"Expanded Assigned"

In the aboce m query the error is in the step #"Expanded Assigned" . I need the solution to belike if column title is blank then it should be null else it should give the value .So  during expanding the column I need to check on this condition.
Any suggestions please? 

NithyaKB_2-1645624614395.png

 

NithyaKB_1-1645624561341.png 

Above is the error message and the error.

 

1 ACCEPTED SOLUTION

various options:

 

- add a step to replace errors

- use try ... otherwise ...     

- investigate the cell contents with Value.Is  before attempting to expand it.

View solution in original post

5 REPLIES 5
v-shex-msft
Community Support
Community Support

HI @NithyaKB,

You can refer to the following links to know how to process these errors.

Odata wiht URL Conventions:

OData URL Conventions

Power query error handling:

Error handling - Power Query | Microsoft Docs

Dealing with errors - Power Query | Microsoft Docs

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
NithyaKB
Helper I
Helper I

Hi,
Yeah but we are in a need to import data through sharepoint online. Can you please suggest the changes to be added in m query.

various options:

 

- add a step to replace errors

- use try ... otherwise ...     

- investigate the cell contents with Value.Is  before attempting to expand it.

Hi,
Can you please help me out with the exact m query

lbendlin
Super User
Super User

Remember that you can run ODATA queries that can pre-filter those rows.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.