<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Detecting Power BI Report Server Environment (Dev or Prod) Using DAX in Report Server</title>
    <link>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4857747#M42228</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1340679" data-lia-user-login="tayloramy" class="lia-mention lia-mention-user"&gt;tayloramy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks! We followed a similar approach using a SQL view — but instead of relying on @@SERVERNAME, we maintain a metadata table (report name, environment, and URL)&lt;/P&gt;</description>
    <pubDate>Fri, 24 Oct 2025 12:03:48 GMT</pubDate>
    <dc:creator>ArwaAldoud</dc:creator>
    <dc:date>2025-10-24T12:03:48Z</dc:date>
    <item>
      <title>Detecting Power BI Report Server Environment (Dev or Prod) Using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4848901#M42126</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;I want to detect the current environment (Dev or Prod) inside my Power BI report after it's published to Power BI Report Server.&lt;BR /&gt;Each environment has a different Web Portal URL:&lt;BR /&gt;&lt;BR /&gt;Dev Server: &lt;A href="http://dev-reportserver/Reports/powerbi/" target="_blank" rel="noopener"&gt;http://dev-reportserver/Reports/powerbi/&lt;/A&gt;...&lt;BR /&gt;Prod Server: &lt;A href="http://prod-reportserver/Reports/powerbi/" target="_blank" rel="noopener"&gt;http://prod-reportserver/Reports/powerbi/&lt;/A&gt;...&lt;BR /&gt;&lt;BR /&gt;I need a way to access the Web Portal URL or server name from within the report, ideally using DAX, so I can dynamically determine which environment the report is running in.&lt;BR /&gt;&lt;BR /&gt;In short, you're trying to dynamically determine the hosting environment of a Power BI report using DAX or other internal logic, based on where it's published.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 11:16:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4848901#M42126</guid>
      <dc:creator>ArwaAldoud</dc:creator>
      <dc:date>2025-10-13T11:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Detecting Power BI Report Server Environment (Dev or Prod) Using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4849025#M42131</link>
      <description>&lt;P&gt;I would create a table in my source database (one for dev and one or prod), and have a config table to store these settings. Then the table can be part of the model for a DAX column or measure.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 13:12:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4849025#M42131</guid>
      <dc:creator>Thomaslleblanc</dc:creator>
      <dc:date>2025-10-13T13:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: Detecting Power BI Report Server Environment (Dev or Prod) Using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4849258#M42135</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="771538" data-lia-user-login="ArwaAldoud" class="lia-mention lia-mention-user"&gt;ArwaAldoud&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There isn’t a supported way for a Power BI report on Report Server to read its own Web Portal URL or server name from DAX. DAX has no concept of the hosting URL, and PBIRS doesn’t surface that as a model property. The usual pattern is to bring an “environment” value in through your data (SQL, M parameter, etc.) and reference it with a simple DAX measure. &lt;A href="https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-url-filters" target="_blank" rel="noopener"&gt;Microsoft Learn confirms URL-based filtering for PBIRS&lt;/A&gt; but not reading the URL inside the report; community threads also note DAX can’t access the browser/URL directly. &lt;A href="https://community.powerbi.com/t5/Desktop/How-to-get-URL-of-current-Report-via-Function/td-p/1932443" target="_blank" rel="noopener"&gt;Example discussion&lt;/A&gt;.&lt;/P&gt;&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;&lt;P&gt;&lt;STRONG&gt;Put the environment in your data and read it with DAX.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If your report hits SQL Server, expose a single-row view that returns your environment based on the server you’re connected to. SQL Server provides @@SERVERNAME, which you can map to “Dev” vs “Prod.” (&lt;A href="https://learn.microsoft.com/en-us/sql/t-sql/functions/servername-transact-sql" target="_blank" rel="noopener"&gt;Docs: @@SERVERNAME&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example SQL view&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;CREATE VIEW dbo.vEnvironment AS
SELECT
  CASE
    WHEN @@SERVERNAME LIKE '%DEV%' THEN 'Dev'
    WHEN @@SERVERNAME LIKE '%PROD%' THEN 'Prod'
    ELSE 'Unknown'
  END AS EnvironmentName;&lt;/PRE&gt;&lt;P&gt;Load dbo.vEnvironment (1 row) into your model and create:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DAX&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Environment =
VAR env = SELECTEDVALUE( vEnvironment[EnvironmentName], "Unknown" )
RETURN env&lt;/PRE&gt;&lt;P&gt;Use [Environment] in cards/titles/conditional formatting. When the same PBIX points at Dev vs Prod SQL, the measure changes automatically.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Oct 2025 17:02:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4849258#M42135</guid>
      <dc:creator>tayloramy</dc:creator>
      <dc:date>2025-10-13T17:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Detecting Power BI Report Server Environment (Dev or Prod) Using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4850463#M42157</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="771538" data-lia-user-login="ArwaAldoud" class="lia-mention lia-mention-user"&gt;ArwaAldoud&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1340679" data-lia-user-login="tayloramy" class="lia-mention lia-mention-user"&gt;tayloramy&lt;/a&gt;&amp;nbsp;&amp;nbsp;the response provided!&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Has your issue been resolved? If the response provided by the community member addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thank you for your understanding!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Oct 2025 07:26:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4850463#M42157</guid>
      <dc:creator>v-tejrama</dc:creator>
      <dc:date>2025-10-15T07:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Detecting Power BI Report Server Environment (Dev or Prod) Using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4856396#M42207</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="771538" data-lia-user-login="ArwaAldoud" class="lia-mention lia-mention-user"&gt;ArwaAldoud&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Tejaswi.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 05:04:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4856396#M42207</guid>
      <dc:creator>v-tejrama</dc:creator>
      <dc:date>2025-10-23T05:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Detecting Power BI Report Server Environment (Dev or Prod) Using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4857741#M42227</link>
      <description>&lt;P&gt;We’ve managed to solve this&lt;/P&gt;
&lt;P&gt;Since Power BI Report Server doesn’t provide a built-in way to detect the hosting environment (Dev or Prod) through DAX, we created a table in each environment’s database ( Dev DB and Prod DB) that includes:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Report Name | Environment | URL (base path + report path)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Before uploading a report, &lt;STRONG&gt;we switch the data source to the correct environment&lt;/STRONG&gt; — for example, Prod when publishing to production, and Dev when working in development.&lt;/P&gt;
&lt;P&gt;Then, within the report,&lt;STRONG&gt; I use a measure to dynamically pick the right URLs based on the report name.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;It required adding the report URLs manually, but it works.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 11:54:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4857741#M42227</guid>
      <dc:creator>ArwaAldoud</dc:creator>
      <dc:date>2025-10-24T11:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Detecting Power BI Report Server Environment (Dev or Prod) Using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4857747#M42228</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1340679" data-lia-user-login="tayloramy" class="lia-mention lia-mention-user"&gt;tayloramy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks! We followed a similar approach using a SQL view — but instead of relying on @@SERVERNAME, we maintain a metadata table (report name, environment, and URL)&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 12:03:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Detecting-Power-BI-Report-Server-Environment-Dev-or-Prod-Using/m-p/4857747#M42228</guid>
      <dc:creator>ArwaAldoud</dc:creator>
      <dc:date>2025-10-24T12:03:48Z</dc:date>
    </item>
  </channel>
</rss>

