cancel
Showing results for 
Search instead for 
Did you mean: 
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.

6 REPLIES 6
Super User II
Super User II

Re: Retrieve server name in DAX

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

Re: Retrieve server name in DAX

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

Super User II
Super User II

Re: Retrieve server name in DAX

@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

Highlighted
ahpitre2
Frequent Visitor

Re: Retrieve server name in DAX

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.

UlfBergqvist Responsive Resident
Responsive Resident

Re: Retrieve server name in DAX

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).

ahpitre2
Frequent Visitor

Re: Retrieve server name in DAX

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.

Helpful resources

Announcements
‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.