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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
black6spd
Frequent Visitor

Error Handling Web Query API stops when invoked function has no result

Thanks in advance!  I have a query pulling taxonomies from the NPPES Npi lookup database through and invoked function.  The issue is when I expand the column to display the specialty of the NPI referenced from my table, it results in an error (provider has been de-activated in the NPI registry) and stops the rest of the query from working.  I would be fine if it continued to display rows with error or "deactivated", but it just stops altogether.  Can anyone help me here?

 

let

    Source = Access.Database(File.Contents("P:\aaaaaa\folderstructurefile.accdb"), [CreateNavigationProperties=true]),

    #"ACCESSQUERY" = Source{[Schema="",Item="ACCESSQUERY"]}[Data],

    #"Invoked Custom Function" = Table.AddColumn(#"ACCESSQUERY”, "SPECIALIST", each NPIFUN([TEXTNPI])),

   

    #"Expanded SPECIALIST" = Table.ExpandTableColumn(#"Invoked Custom Function", "SPECIALIST", {"Value"}, {"SPECIALIST.Value"}),

    Value = #"Expanded SPECIALIST"[Value]

in

    Value

 

This is from advanced editor.  I just want all records to show, whether or not there is information associated with it.

 

Also, here is the function 

 

let
Source = (#"NPI LOOKUP" as text) => let
Source = try Json.Document(Web.Contents("https://npiregistry.cms.hhs.gov/api/?version=2.1&number=" & #"NPI LOOKUP"))otherwise null,
results = Source[results],
results1 = results{0},
taxonomies = results1[taxonomies],
taxonomies1 = taxonomies{0},
#"Converted to Table" = Record.ToTable(taxonomies1),
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each ([Name] = "desc")),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Name"})
in
#"Removed Columns"
in
Source

1 ACCEPTED SOLUTION
black6spd
Frequent Visitor

https://community.powerbi.com/t5/Desktop/New-user-add-custom-column-that-queries-data-from-Web-Conte...

 

I re-read this again and replaced errors with null.  It is working now.  I had to do that before expanding the column.

View solution in original post

2 REPLIES 2
dax
Community Support
Community Support

Hi @black6spd , 

You said that you get error when invoke function, so, if possible, could you please inform me more detailed information? And whether there is tutorial document of your function?

Best Regards,
Zoe Zhi

black6spd
Frequent Visitor

https://community.powerbi.com/t5/Desktop/New-user-add-custom-column-that-queries-data-from-Web-Conte...

 

I re-read this again and replaced errors with null.  It is working now.  I had to do that before expanding the column.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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