Forum Discussion
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
- AnonymousNot 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).
- ahpitre2Frequent Visitor
Do you know any way to retrieve environment variables via DAX? Thinking that it would be possible this way.