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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
JoeFields
Frequent Visitor

Error when applying schema with nullable records

I am getting errors on Record type objects when I try to apply a schema in my custom connector even though I have added the nullable type identifier.

The below example shows whenever I have location = null, it throws an error.

JoeFields_0-1695926712423.png

 

Here is a condensed listing of how I am defining my schema in my PQ file:

ProjectType = type table [
...
    location = nullable LocationType,
...],
    LocationType = type [
        country = text,
        state = text,
        streetName = text,
        streetNumber = text,
        suite = text,
        city = text,
        zip = text,
        complete = text,
        coords = nullable CoordsType
    ]

I have defined location as being a nullable record.

 

I copied the Table.ChangeType helper function from here: https://learn.microsoft.com/en-us/power-query/helper-functions#tablechangetype.

 

If I change the schema definition to nullable any then it works but then I do not have my schema applied for the location records that are provided.

ProjectType = type table [
...
    location = nullable any,
...],

 

1 REPLY 1
jennratten
Super User
Super User

Hello @JoeFields - you need to add a step in your query (before the point at which the error is thrown) which converts null values into empty records so that the field can be evaluated like a record, like this:

Table.TransformColumns(Source, {{“Column1”, each if Value.Is(_, type record) then _ else [a=_] }} )

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors