Power Bi-Power Query-Blank File Method

Power Bi-Power Query-Blank File Method

a) Using a Blank File

Step 1: Generate Reports

First, generate the Profit and Loss and Balance Sheet reports by following the respective guides.

Step 2: Access Power Query

  1. Open Power BI Desktop.
  2. Go to the Home tab and click on Get Data.

  3. Select Blank Query.

Step 3: Configure Power Query

  1. In the Power Query Editor, go to the Home tab and select Advanced Editor.

       
  2. Remove the existing code and replace it with the provided code.

    let

        Token = "Bearer (Paste the Bearer Token)",

        Url = "(Profit & Loss API URLor any other URL)",

        

        GetAPIData = (token as text) as record =>

    let

    Source = Json.Document(Web.Contents(Url, [Headers=[Authorization=token]])),

    AnotherAPICall = if Record.HasFields(Source, {"url"}) then

    Json.Document(Web.Contents(Source[url]))

    else

    Json.Document(Source[data]),

    Result = AnotherAPICall

    in

    Result,

    FinalResult = GetAPIData(Token)

    in

    FinalResult

  3. Replace the placeholder text with your actual Bearer Token and Report API URL.

       
  4. Click Done.

Step 4: Finalize Data Import

  1. Click on Edit Credentials, select Connect, and set the Privacy level to Public.
  2. Click on Into Table.

  3. Click on the double-sided arrow next to the column header, then select Expand to new rows.

       
  4. Click OK to display the data in Power BI.