Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
ahpitre2
Frequent Visitor

Retrieve server name in DAX

In SQL I can use SELECT @@servername to get the current server where query is running. Is there something similar in DAX where I can retrieve the server where a report is executing? I have a local (on my PC) Power BI Reporting Server installed. I also test reports on Dev Power BI servers. Currently working on a report that builds a URL via DAX and allows user to click on Power BI URL and a tab opens with a related SSRS details report. Current URL is being built with the value of the server hard coded, if possible would like to generate the parent section of URL dynamically. This is my current URL :

 

 

SSRS_Parent_URL = "http://someserver.local/ReportServer/Pages/ReportViewer.aspx?%2fTeam%2fMarketingReport&"

 

 

 

This is what I would like to accomplish :

 

 

SSRS_Parent_URL = ParentServer & "/ReportServer/Pages/ReportViewer.aspx?%2fTeam%2fMarketingReport&"

 

 

 

ParentServer would be a DAX measure that dynamically retrieves the underlying servername. Researched online, but till now I haven't found a viable solution.

7 REPLIES 7
Anonymous
Not applicable

Hi, I don't think it's possible to get the server name from DAX.

 

Perhaps you can

- Use relative URL:s? (skip the http://servername/ part)

- Add the server name to a settings table in the server and load it into the model using a localhost connection (if you have SQL running on the server / your machine).

How do you the the URL from the table and make it an active URL in PowerBI?  Thanks.

Great idea. Unfortunately I can do this on my local computer, but not on the server (I don't have necessary permissions). Thanks for the input.

az38
Community Champion
Community Champion

Hi @ahpitre2 

I dont see any chance to acknowledge server URL with DAX


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
ahpitre2
Frequent Visitor

Do you know any way to retrieve environment variables via DAX? Thinking that it would be possible this way.

az38
Community Champion
Community Champion

@ahpitre2 

right now there is no such feature.

DAX is the only business logic language and it doesnt and shouldnt support system enviroment parameters


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
ahpitre2
Frequent Visitor

I think it would be useful, and doesn't hurt to be able to read environment variables. This is very common in other languages tools (VBA, .NET, JAVA, etc.). Anyway, thanks for your input.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors