> ## Documentation Index
> Fetch the complete documentation index at: https://docs.speckle.systems/llms.txt
> Use this file to discover all available pages before exploring further.

# Power BI Data Gateway

> Setting up data gateways for Power BI scheduled refresh

export const PowerBIVersionFetcher = ({fallbackVersion = '3.3.3'}) => {
  const [version, setVersion] = useState(fallbackVersion);
  const [downloadUrl, setDownloadUrl] = useState(`https://releases.speckle.dev/build-artifacts/powerbi-v3/speckle.powerbi.installer-${fallbackVersion}.zip`);
  const parseXMLResponse = xmlText => {
    try {
      const parser = new DOMParser();
      const xmlDoc = parser.parseFromString(xmlText, 'text/xml');
      const contents = xmlDoc.getElementsByTagName('Contents');
      const powerBIEntries = [];
      for (let content of contents) {
        const key = content.getElementsByTagName('Key')[0]?.textContent;
        const lastModified = content.getElementsByTagName('LastModified')[0]?.textContent;
        if (key && key.includes('build-artifacts/powerbi-v3/speckle.powerbi.installer-') && key.endsWith('.zip')) {
          const versionMatch = key.match(/speckle\.powerbi\.installer-(\d+\.\d+\.\d+)\.zip$/);
          if (versionMatch) {
            powerBIEntries.push({
              version: versionMatch[1],
              key: key,
              lastModified: new Date(lastModified)
            });
          }
        }
      }
      if (powerBIEntries.length === 0) {
        throw new Error('No Power BI build artifacts found');
      }
      powerBIEntries.sort((a, b) => b.lastModified - a.lastModified);
      return powerBIEntries[0].version;
    } catch (parseError) {
      console.error('Error parsing XML:', parseError);
      throw parseError;
    }
  };
  const fetchLatestVersion = async () => {
    try {
      const response = await fetch('https://releases.speckle.dev');
      if (!response.ok) {
        throw new Error(`HTTP error! status: ${response.status}`);
      }
      const xmlText = await response.text();
      const latestVersion = parseXMLResponse(xmlText);
      setVersion(latestVersion);
    } catch (fetchError) {
      console.error('Error fetching latest version:', fetchError);
    }
  };
  useEffect(() => {
    fetchLatestVersion();
  }, [fallbackVersion]);
  useEffect(() => {
    if (version) {
      const url = `https://releases.speckle.dev/build-artifacts/powerbi-v3/speckle.powerbi.installer-${version}.zip`;
      setDownloadUrl(url);
    }
  }, [version]);
  return <div style={{
    textAlign: 'center'
  }}>
      <a href={downloadUrl} target="_blank" rel="noopener noreferrer" style={{
    display: 'inline-block',
    backgroundColor: '#3b82f6',
    color: 'white',
    padding: '8px 16px',
    borderRadius: '6px',
    textDecoration: 'none',
    fontSize: '14px',
    fontWeight: '500',
    border: 'none',
    cursor: 'pointer'
  }}>
        Download Power BI connector
      </a>
    </div>;
};

Data gateways enable scheduled refresh of your Power BI reports, ensuring your Speckle data stays up-to-date automatically. This is especially useful for production reports that need to reflect the latest model versions without manual intervention.

## Choosing the Right Gateway Mode

**Personal Mode** is ideal for individual users who need to:

* Connect their own Power BI reports to on-premises data sources
* Use scheduled refresh for data updates
* Keep setup simple with minimal configuration

**Standard Mode** is recommended for organizations that need to:

* Share data sources across multiple users
* Integrate with other Microsoft services (Power Apps, Power Automate, Azure Logic Apps)
* Use advanced features like DirectQuery and Live Connection
* Have centralized management and monitoring capabilities

<Note>
  Microsoft recommends using Standard Mode for most organizational scenarios due to its enhanced capabilities and flexibility.
</Note>

## Personal Mode Gateway

<Steps>
  <Step title="Install Power BI connector and data gateway">
    1. Download and install Power BI connector from [https://app.speckle.systems/connectors](https://app.speckle.systems/connectors) .

    2. Download and install [**On-premises data gateway (personal mode)**](https://go.microsoft.com/fwlink/?LinkId=820925\&clcid=0x409).

    3. Open the installed data gateway.

    4. Select **Sign In** and sign in to your account.
           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/personal%20dg%20sign%20in.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=af7a28848c6d989a0c1663d344bb051c" alt="Personal gateway sign in" width="1620" height="1080" data-path="images/connectors/powerbi/personal dg sign in.png" />
           </Frame>
           <Note>
             Verify the gateway appears in Power BI service under **Settings** > **Manage connections and gateways** > **On-premises data gateways**. Select **On-premises data gateways (Personal mode)** from the gateway type menu.
           </Note>

    5. Select the **Connectors** tab and verify Speckle appears in the connectors list.
           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/personal%20dg%20connectors.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=27c3f0b522ed73cdd8ce27988f9e392c" alt="Personal gateway connectors" width="1620" height="1080" data-path="images/connectors/powerbi/personal dg connectors.png" />
           </Frame>
           <Note>
             Check the path shown in the data gateway and make sure the **Speckle.pqx** file is there. If not, copy it from the installed location and paste it there.
           </Note>

    6. Publish your report.
  </Step>

  <Step title="Configure Power BI Service">
    1. Open your published report in Power BI Service.

    2. Select **More Options (…) > View semantic model** from the top bar.
           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/dg%20view%20semantic%20model.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=c6d7078937643774f12080f76dd71f90" alt="View semantic model" width="1620" height="1080" data-path="images/connectors/powerbi/dg view semantic model.png" />
           </Frame>

    3. Select **Refresh > Schedule Refresh**. This opens settings for the semantic model.

           <Frame>
             <img src="https://mintcdn.com/speckle/dHRV1x-j0fvZplfP/images/connectors/powerbi/dg%20schedule%20refresh.png?fit=max&auto=format&n=dHRV1x-j0fvZplfP&q=85&s=997f6bfc74d27c113053ddd84a785f49" alt="Schedule refresh" width="1620" height="1080" data-path="images/connectors/powerbi/dg schedule refresh.png" />
           </Frame>

    4. Expand **Gateway and cloud connections** and check if your personal gateway is listed here.

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/personal%20dg%20gateways%20list.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=63b28e44cbda49625ba96888576788bb" alt="Personal gateway list" width="1620" height="1080" data-path="images/connectors/powerbi/personal dg gateways list.png" />
           </Frame>

    5. After you confirm the personal gateway is listed, select **Data source credentials**, then select **Speckle** > **Edit credentials**.

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/personal%20dg%20edit%20credentials.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=d5e2d33d80d116bef2bfb0266cc8dfc7" alt="Edit credentials" width="1620" height="1080" data-path="images/connectors/powerbi/personal dg edit credentials.png" />
           </Frame>

    6. Select **OAuth2** as your authentication method. Set the privacy level setting according to your needs.

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/personal%20dg%20oauth.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=392734727485210ab9e09e7c32647bf0" alt="OAuth setup" width="1620" height="1080" data-path="images/connectors/powerbi/personal dg oauth.png" />
           </Frame>

    7. Select **Sign in** and sign in to your Speckle account from the window that opens.

    You can now configure scheduled refresh.
  </Step>
</Steps>

## Standard Mode Gateway

<Steps>
  <Step title="Install data gateway and Power BI connector">
    1. Download and install [On-premises data gateway](https://go.microsoft.com/fwlink/?LinkId=820925\&clcid=0x409). (external)

    2. Open the data gateway.

    3. Select **Sign In** and sign in to your account.

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/on%20prem%20sign%20in.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=355e310d46cd33f92b4cac63cbae0501" alt="Standard gateway sign in" width="1620" height="1080" data-path="images/connectors/powerbi/on prem sign in.png" />
           </Frame>

           <Note>
             Verify the gateway appears in Power BI service under **Settings** > **Manage connections and gateways** > **On-premises data gateways**.
           </Note>

    4. Select the **Connectors** tab and copy the path to Custom Connectors folder

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/on%20prem%20copy%20path.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=66161cf9e0515cc3a29fce6551b3b4cd" alt="Copy connectors path" width="1620" height="1080" data-path="images/connectors/powerbi/on prem copy path.png" />
           </Frame>

           <Note>
             If you see a folder not found warning, go to the path and create the Power BI Desktop and Custom Connectors folders if they're missing.
           </Note>

    5. Download Power BI connector zip:

    <PowerBIVersionFetcher />

    6. Extract the zip file contents and copy the `Speckle.pqx` file.
    7. Paste the file to the location shown in the Connectors tab. The default path is:
       `C:\WINDOWS\ServiceProfiles\PBIEgwService\Documents\Power BI Desktop\Custom Connectors`
    8. Verify Speckle appears under Custom Connectors tab.

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/on%20prem%20connectors.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=00dded40fb44ad1239d53e9811d15a3b" alt="Standard gateway connectors" width="1620" height="1080" data-path="images/connectors/powerbi/on prem connectors.png" />
           </Frame>
  </Step>

  <Step title="Configure Power BI Service">
    1. Open your published report in Power BI Service.

    2. From the top bar, select **More Options (…) > View semantic model**.

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/dg%20view%20semantic%20model.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=c6d7078937643774f12080f76dd71f90" alt="View semantic model" width="1620" height="1080" data-path="images/connectors/powerbi/dg view semantic model.png" />
           </Frame>

    3. Select **Refresh > Schedule Refresh** to open settings for the semantic model.

           <Frame>
             <img src="https://mintcdn.com/speckle/dHRV1x-j0fvZplfP/images/connectors/powerbi/dg%20schedule%20refresh.png?fit=max&auto=format&n=dHRV1x-j0fvZplfP&q=85&s=997f6bfc74d27c113053ddd84a785f49" alt="Schedule refresh" width="1620" height="1080" data-path="images/connectors/powerbi/dg schedule refresh.png" />
           </Frame>

    4. Expand **Gateway and cloud connections** and check if your gateway is listed.

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/on%20prem%20gateway%20listed.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=940851d1ccfcc8767f1cd1197ac44163" alt="Gateway listed" width="1620" height="1080" data-path="images/connectors/powerbi/on prem gateway listed.png" />
           </Frame>

    5. If you see "Not configured correctly" under status, select **View data sources (▶️)**.

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/on%20prem%20view%20data%20source.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=4136ab93eb6b3fd35c812f523015e325" alt="View data sources" width="1620" height="1080" data-path="images/connectors/powerbi/on prem view data source.png" />
           </Frame>

    6. Select **Manually add to gateway** for the Speckle model you've loaded.

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/on%20prem%20manually%20add.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=afcdcaf621f315a1c0967a01ebddbaa7" alt="Manually add to gateway" width="1620" height="1080" data-path="images/connectors/powerbi/on prem manually add.png" />
           </Frame>

    7. Create a new connection.

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/on%20prem%20create%20connection.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=34383a9baa055230e8cc1d55a33e5bca" alt="Create connection" width="1620" height="1080" data-path="images/connectors/powerbi/on prem create connection.png" />
           </Frame>

       * Name your connection: You can use model URL as the name.
       * Paste model URL in **Speckle Model URL** field.
       * Select **Speckle Account** as the authentication method.
       * Select **Edit credentials** and sign in to your Speckle account in the window that opens.
       * Set the privacy level according to your organization settings.
       * Select **Create** to create the connection.

    8. Go back to the semantic model settings page.

    9. Select the newly created collection name from the **Maps to** dropdown and select **Apply**.

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/on%20prem%20maps%20to.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=3ea49a6b5cfdea425fcc6e00a76eb938" alt="Maps to dropdown" width="1620" height="1080" data-path="images/connectors/powerbi/on prem maps to.png" />
           </Frame>

    10. Your data gateway is now configured for scheduled refresh.
  </Step>
</Steps>

<AccordionGroup>
  <Accordion title="Error message: 'Query contains unknown function name: Speckle.GetByUrl'">
    <Frame>
      <img src="https://mintcdn.com/speckle/IJ1tbtp_b_IB9fr1/images/connectors/powerbi/dg%20unknown%20function.png?fit=max&auto=format&n=IJ1tbtp_b_IB9fr1&q=85&s=71d2cd8cbaaba83d679460deb81de393" alt="Unknown function error" width="822" height="126" data-path="images/connectors/powerbi/dg unknown function.png" />
    </Frame>

    **To troubleshoot this error:**

    1. Verify the gateway appears in Power BI service under **Settings** > **Manage connections and gateways** > **On-premises data gateways**.

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/dg%20verify%20gateway.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=84d19e429d1738f5062a00d4e391572a" alt="Verify gateway" width="1620" height="1080" data-path="images/connectors/powerbi/dg verify gateway.png" />
           </Frame>

    2. Verify Speckle appears in the Connectors tab in data gateway.

           <Frame>
             <img src="https://mintcdn.com/speckle/UUn1T02Bt-Bwctc0/images/connectors/powerbi/on%20prem%20connectors.png?fit=max&auto=format&n=UUn1T02Bt-Bwctc0&q=85&s=00dded40fb44ad1239d53e9811d15a3b" alt="Verify connectors" width="1620" height="1080" data-path="images/connectors/powerbi/on prem connectors.png" />
           </Frame>

    3. If both are true, publish a new dataset with default connectors (CSV, Excel, etc.) from Power BI Desktop and set data source credentials for it in Power BI service

    4. Go back to the report that throws the error and try again

    The report should now work properly.

    **Why this works**

    Custom connectors require a dataset with verified connectors to be published first. After you publish a dataset with standard connectors, custom connectors will work with the data gateway. You only need to do this once per data gateway.
  </Accordion>
</AccordionGroup>

<Note>
  Learn more about data gateways and scheduled refresh from Microsoft:

  * [On-premises data gateway (personal mode)](https://learn.microsoft.com/en-us/power-bi/connect-data/service-gateway-personal-mode)
  * [On-premises data gateway (standard mode)](https://learn.microsoft.com/en-us/power-bi/connect-data/service-gateway-onprem-indepth)
  * [Configure scheduled refresh](https://learn.microsoft.com/en-us/power-bi/connect-data/refresh-scheduled-refresh)
</Note>
