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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Can you determin within M if the code is running on Desktop or Service

I was wondering of anyone has figured out within M how to determin if the code is running on the Desktop or Service.

 

Basically I want to branch the code and do A if running on desktop and B if in the cloud.

 

Any ideas?

 

Cheers

 

Andrew

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your problem.


Best Regards,
Stephen Tao

Anonymous
Not applicable

Hi @Anonymous ,

 

I am afraid that this function is not currently available. 

 

I think you might want to restrict data access, it is suggested to try to use row-level-security.

 

https://docs.microsoft.com/en-us/power-bi/admin/service-admin-rls

 

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-rls

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

GilbertQ
Super User
Super User

Hi there

What if you had to look at the time of the server the code is running on?

All the servers are running on UTC for the Power BI Services.

As long as you are in a different timezone you could then get the timezone in M, and based on the result you could then do A or B?




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors