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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
deldersveld
Resident Rockstar
Resident Rockstar

Conditional Refresh

Does anyone have an example of an M script where a parameter was employed so that a query refreshes in Desktop and doesn't refresh in Service (or vice versa)? I was thinking something along the lines of checking the parameter value, and if true, proceed through a set of scripted steps. If false, effectively go to the end of the script without executing any steps.
 
Any alternative thoughts on how something like this could be accomplished?

EDIT: After thinking this through a bit, I should use better terminology. The refresh itself would not be conditional. The refresh always occurs. Based on the parameter settings however, Part of the script would execute or it would call a separate function. Does anyone have a good example of code with logic like that?
1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@deldersveld,

 

You may take a look at the following article.

https://community.powerbi.com/t5/Community-Blog/Conditional-Code-Branching-in-Power-BI-Query-if-then...

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@deldersveld,

 

You may take a look at the following article.

https://community.powerbi.com/t5/Community-Blog/Conditional-Code-Branching-in-Power-BI-Query-if-then...

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks. This type of logic is exactly what I was after.

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

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