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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.