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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
KCinMelbourne
Resolver I
Resolver I

How to End a Query if Condition is Met (Query Editor / M)

Hi all,

 

I am looking for a solution that says:

if <condition> then <perform action> else <end query> 

Is this possible in M?

 

Also there are a number of queries where if a condition is met, I effectively don't want the query to execute at all. Is that possible?  For example:

 

if <Parameter A = "Disable"> then  <end query without any content> else <query actions>

Cheers

Kirsty 

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @KCinMelbourne,

 

Please check if below blog helpful to your scenario:

Conditional Code Branching in Power BI Query: if...then...else => then...else...if

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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-yulgu-msft
Employee
Employee

Hi @KCinMelbourne,

 

Please check if below blog helpful to your scenario:

Conditional Code Branching in Power BI Query: if...then...else => then...else...if

 

Best regards,

Yuliana Gu

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

Perfect, thank you!

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.