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
Griffin_BI
Frequent Visitor

Tell programmatically or otherwise if a query is being run on the Service or Desktop

I have a pbix file that runs some Python at the end of a Power Query data refresh. I don't want the Python to run if I'm doing dev work on the file. Is there any way to prevent this from happening? Is there any way to tell programmatically or otherwise if a query is running on the desktop or on the service?

 

Thanks!

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hello @Griffin_BI ,

 

yes, you can set a parameter in Power Query, lets say "Platform".

This parameter you can set to the value "Desktop" and then not run the python script if "Platform" = "Desktop".

 

On the Power BI Service you can change the value of the parameter to "Service" and then the python script should run.

Check the following tutorial, here they just change the data source for Desktop and Service, but you will get how it works:

Change the Source of Power BI Datasets Dynamically Using Power Query Parameters - RADACAD

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

2 REPLIES 2
selimovd
Super User
Super User

Hello @Griffin_BI ,

 

yes, you can set a parameter in Power Query, lets say "Platform".

This parameter you can set to the value "Desktop" and then not run the python script if "Platform" = "Desktop".

 

On the Power BI Service you can change the value of the parameter to "Service" and then the python script should run.

Check the following tutorial, here they just change the data source for Desktop and Service, but you will get how it works:

Change the Source of Power BI Datasets Dynamically Using Power Query Parameters - RADACAD

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

@selimovd thanks for the reply. That is a decent solution and workable. I could put the parameter in the Python string in the formula box in Power Query.

 

Ideally the solution would be able to tell without any manual input whether the .pbix is refreshing on the desktop or service, but if no one else replies I will mark this as a solution. 

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