Forum Discussion

RussellBode's avatar
RussellBode
Icon for Helper I rankHelper I
11 months ago
Solved

Integrating Web API Parameters in Power BI Paginated Reports

  Hello, I’m currently working on integrating Power BI Paginated Reports with a Web API. We have the following M code query that works in Power BI Desktop because the parameter PAR_SEL_PROJECT can ...
  • rohit1991's avatar
    11 months ago

    Hi RussellBode 

    The key difference is that Power BI Desktop and Paginated Report Builder handle parameters differently.

    In Power BI Desktop, you can pass PAR_SEL_PROJECT directly inside the M query and it will resolve because Desktop supports dynamic parameters in the query editor.But in Paginated Reports, you cannot pass Power Query M parameters directly  Report Builder expects you to define Report Parameters and then link them to your dataset query.

    How to fix it:

    1. Define a Report Parameter

    • In Report Builder, create a report parameter (for example @PAR_SEL_PROJECT).
    • This will allow the user (or the report action) to pass a value.

    2. Modify the Power Query / Data Source in Report Builder

    • In the query designer (or dataset properties), replace your hard-coded parameter reference with the @ syntax that Report Builder understands.

    Example:

    let
       Source = Json.Document(
           Web.Contents(
                   "https://my429741.businessbydesign.cloud.sap/sap/byd/odata/ana_businessanalytics_analytic.svcc/RPZ0F… eq '" & @PAR_SEL_PROJECT & "'&$format=json"
           )
       ),
       Converted = Table.FromRecords({Source})
       // expand as before …
    in
       Converted

    3. Notice here:

    • In Report Builder you must use the @ParameterName style.
    • The parameter value will be substituted at runtime.

    4. Bind the Parameter

    • Go to Dataset Properties >> Parameters and map your report parameter (@PAR_SEL_PROJECT) to the query parameter you used in the URL.
    • This step makes the report parameter flow into the dataset query.

    5. Deploy and Test

    • When you run the Paginated Report, it will prompt for the project ID (or you can pass it programmatically when embedding).
    • The API call will now correctly use the dynamic value.