Dynamic Table Extractions with Power BI
This article shows how to create dynamic SAP table extractions using Xtract Universal and Microsoft Power BI Desktop by parameterizing WHERE Clauses in Power Query (M-scripts).
About WHERE Clauses in Power BI
When connecting Power BI to SAP via Xtract Universal, you can define static and/or dynamic WHERE Clauses in the M-script to filter table records. This article covers the following WHERE Clause scenarios:
-
Static WHERE Clauses in Power BI:
A hardcoded filter condition in the M-script that does not change unless the query is manually modified. Static WHERE Clauses use fixed values to return corresponding table records. The following sample WHERE Clause returns records where values in the column GJAHR of SAP table ACDOCA equal2025:The WHERE Clause translates into the M-script as follows:
-
Dynamic WHERE Clauses using Power BI parameters:
A WHERE Clause dynamically built in the M-script using Power BI parameters. This scenario allows filter values to be changed without editing the query logic. The following sample WHERE Clause returns records where values in the column GJAHR of SAP table ACDOCA equal the parameterpGJAHR:The WHERE Clause translates into the M-script as follows:
-
Dynamic WHERE Clause using mapped parameters:
A WHERE Clause defined and dynamically built inside Xtract Universal using custom runtime parameters mapped to Power BI parameters. In this scenario, the filter logic remains inside Xtract Universal while values are controlled in Power BI. The following sample WHERE Clause returns records, where values in the column FISCYEARPER range between the values of the parametersmyFISCYEARPER_fromandmyFISCYEARPER_to:Map the Xtract Universalparameters to Power BI parameters in the M-script as follows:
Refer to Documentation: WHERE Clause Syntax for information on:
- how to write WHERE Clauses.
- data formats for parameter values, e.g.,
YYYYMMDDfor dates.
Set Up a Power Query in Power BI
Follow the steps below to set up a Power Query (M-script) to connect with Xtract Universal and query dynamic SAP data. This article focuses on Power BI Desktop; instructions vary for Power BI Service and Power BI Report Server:
- Create a new Report or edit an existing Report:
- New Report: go to Home > Blank Report > Get Data > Blank Query.
- Existing Report: open the Report and go to Home > Transform Data.
- Create Power BI parameters for your dynamic WHERE Clause in Home > Manage Parameters > New Parameter. Example:

- Open the Advanced Editor.

- Copy the content of the loading_script.txt file into the Advanced Editor.
- Change the values for ExtractionName and ServerURL to match the name of your Xtract Universal extraction name and server URL .

-
Enter values for Parameters to pass them to Xtract Universal. This includes passing whole WHERE Clauses:
-
Static WHERE Clause with fixed value:
-
Dynamic WHERE Clause, where
pGJAHRis a Power BI parameter: -
Map Xtract Universal parameters (
myFISCYEARPER_fromandmyFISCYEARPER_to) used in a WHERE Clause in Xtract Universal with Power BI parameters (pFISCYEARPER_fromandpFISCYEARPER_to):
-
-
Click [Done] to confirm the script .
- If prompted, provide an authentication method for the Power BI and Xtract Universal connection. For more information, see Single Sign On and SAP Authentication.
- Close the Power Query Editor and apply changes when prompted.
- Save the Report.
The new Power BI Report queries SAP data using Power BI parameters.
Related Links
- Documentation: Table - WHERE Clauses
- Documentation: Table - Runtime Parameters
- Documentation: Power BI Destination
- Documentation: Extraction Parameters
- Microsoft Documentation: Parameters in Power BI Desktop
Last update: January 14, 2026