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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors