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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Negi1984
Regular Visitor

How to Remove All columns Error while importing Json table

Hi All,

 

I want to replace all Errors messages with "NULL" in all the columns.

I am import data from JSON and it is giving me error like below for mulitple columns .

 

error query.JPG

 

Below is the code which I am using now :-

 

let
Source = Json.Document(Web.Contents("XXXXXXXXXXXXXXXXX")),
data1 = Source[data],
Table = Table.FromRecords(data1)
in
Table

 

Can anybody suggest me , which custom code can help me to replace error with Null in one go ?

 

Regards,

Rajender

1 ACCEPTED SOLUTION

Hi @Negi1984,

 

Why not just following the built-in functions? Please refer to the snapshot below.

How_to_Remove_All_columns_Error_while_importing_Json_table

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
donsvensen
Continued Contributor
Continued Contributor

Hi Rajender,

 

The function table.FromRecords has an optional parameter where you can specify how the function should handle missing fields

 

https://msdn.microsoft.com/en-us/query-bi/m/table-fromrecords

 

So you can add MissingField.UseNull to set finishTime to null - and you should set the second argument to specify you table's columns and data type as shown in the documentation.

 

/Erik

 

Hi Donsvensen,

 

Thanks a lot for your prompt feedback. I check the link but unable to understand.

Could you please assist , what modification exactly I need to require in 3rd line ?

 

let
 Source = Json.Document(Web.Contents("XXXXXXXXXXXXXX")),
 data1 = Source[data],
 Table = Table.FromRecords(data1)

 

in
   
Table

 

My Headers in Data are mentioned below :-

 

dataComplete
finishTime
hostName
jobExecutionId
jobExecutionNumber
jobFinishedEventId
jobInstance
jobQueuedEventId
jobStartedEventId
queuedTime
ran
resultCode
startTime
track

 

Thank you once again for your support.

donsvensen
Continued Contributor
Continued Contributor

Hi

 

Properly looks something like this

 

Table =Table.FromRecords(data1, {"dataComplete", "finishTime", "hostName", "jobExecutionId", "jobExecutionNumber", "jobFinishedEventId", "jobInstance", "jobQueuedEventId", "jobStartedEventId", "queuedTime", "ran", "resultCode", "startTime", "track"}, {"dataComplete", "finishTime", "hostName", "jobExecutionId", "jobExecutionNumber", "jobFinishedEventId", "jobInstance", "jobQueuedEventId", "jobStartedEventId", "queuedTime", "ran", "resultCode", "startTime", "track"}, MissingField.UseNull )

 

Hope this helps you

 

/Erik

Hi,

 

I replace the below code with my PQ code. but its giving me another error like below :-

 

error query2.JPG

donsvensen
Continued Contributor
Continued Contributor

Hi

 

Could you share a screenshot from your previous step ?

 

/Erik

Hi,

 

Please find the snapshot of previous steps :-

 

Step2.JPGStep1.JPG

Hi @Negi1984,

 

Why not just following the built-in functions? Please refer to the snapshot below.

How_to_Remove_All_columns_Error_while_importing_Json_table

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Dale,

 

Thanks a lot for your valuable. Its working fine now . Now no error.

 

Regards,

Rajender

Hi @Negi1984

 

I agree with @v-jiascu-msft - if you still have problems let us know

 

Best 

Erik

Hi,

 

I am able to get the desired result. Thanks a lot for your valuable time.

 

Regards,

Rajender

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.