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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
pavel_severov
Advocate I
Advocate I

Check current environment: "desktop" or "service"

Hello! Is there way to check current environment in Power Query?
I.e. - is it running on "desktop" or "service"?

The reason I'm asking - I want my report to automatically use different data sources, depending: is it working on my PC? or on the server?.

 

5 REPLIES 5
aalev
Frequent Visitor

hello pavel_severov, I have the same need, did you sort it out ?

 

I tried with parameters, but it's not satisfying:

- My M code uses env paramter to select right sources (if env = ...)

- My pbix has env = A

- I publish the pbix, it overwrites the PBI service parameter & triggers a refresh

- As soon as the refresh is finished, I can modify the PBI service parameter to env = B

 

I'm looking for a way without having to update PBI service parameter each time I publish.

Any idea ?

 

Alban

 

Hi aalev,

Unfortunately there is no way to get any environment data from Power BI scripts.
At least I don't know anything about it. I would be happy to be wrong.

Ok, thanks @pavel_severov , I submited a feature request here: 

Power query environment variable to distinguish Power BI Desktop from Power BI Service

Please support with your votes  !

Alban

 

v-juanli-msft
Community Support
Community Support

 

ok

 

Best Regards

Maggie

 

Greg_Deckler
Super User
Super User

I am not aware of a way to do that. I suppose you could set a query parameter just before you publish it?

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors