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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.