Forum Discussion
Can we skip data access (Getting data from a source ) in case we don't have access or something else
- 1 year ago
Hi KR300
Did you gpot any chance to look over below suggested code replace it in your code.
To handle errors gracefully in Power BI when a specific API call (based on a parameter like FixVersionName) fails or returns no data, and still allow your report and scheduled refresh to succeed, you can use try ... otherwise to safely fall back to a blank placeholder table. Here’s how to do it in your scenario:
********************************************************let
FixVersionName = ... // your parameter
Placeholder = #table(
{"Key", "Summary", "IssueType Name", "Component Name", "FixVersion Name", "Priority Name", "Status Name"},
{{"", "", "", "", "", "", ""}}
),SafeCall = try Json.Document(
Web.Contents(
"https://jira.tools.deloitteinnovation.us/rest/api/2/search?jql=project%20%3D%20SMAR%20AND%20issuetyp..." &
FixVersionName & "&maxResults=1000&fields=key,summary,fixVersions,priority,status,components,issuetype"
)
),Source = if SafeCall[HasError] then Placeholder else SafeCall[Value]
in
Source********************************************************
You can then continue your existing transformation steps on this Source safely, as it will always return a valid table shape (even if empty).
If the above information helps you, please give us a Kudos and marked the Accept as a solution.
Best Regards,
Community Support Team _ C Srikanth
Where does FixVersionName come from? A static list?
You cannot "skip" - you MUST return a result at the end of the Power Query code. However you CAN provide an empty table if there's nothing in Jira.
It is a Parameter that created in Power Query which has list of values like below
SFP.R.12.1
SFP.R.12.2
SFP.R.12.3
SFP.R.12.4
the Users want to see any FixVersion Release, they can change the Parameter in the PBI service , after that they click refresh the semantic model then they will that FixVersion Data.
Suppose, if anybody select SFP.R.12.3 value in the FixVersionName Parameter, the report wil be refrshed without any error by just skipping the connecion or based on any condition , hey this SFP.12.3 API doesn't work or no access or if it says any error found, pls give an Static meassage or an empty table or nothing...
but the main things is ; Schedule refresh ned to be completed successfully without any error showing in the Reftresh history