Forum Discussion

KR300's avatar
KR300
Helper III
1 year ago
Solved

Can we skip data access (Getting data from a source ) in case we don't have access or something else

Hi MS Team,   I am getting data from Jira API's  - Dashboard about about Project Development Stories, Bugs, ... )   Json.Document(Web.Contents("https://jira.tools.deloitteinnovation.us/rest/api/2...
  • v-csrikanth's avatar
    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