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
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

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.