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

Power Query: Multiple actions in if statement

Hey all,

So I'm basically trying to get the answer @th3h0bb5 never got: https://community.powerbi.com/t5/Desktop/Powerquery-Multiple-actions-in-IF-statement/td-p/1086609. Or @jthomson for that matter: https://community.powerbi.com/t5/Desktop/If-statement-multiple-actions/m-p/360729#M162818

 

I want to have an if statement where the then and else contain two (or more) actions, so following the following pattern:

if a = b
then
do action 1
do action 2
else
do action 3
do action 4

 

I read somewhere that should be possible by using let ... in however Power Query treats it like a function rather than performing the actions, asking me for a parameter ( _ (optional) )

= each if Text.StartsWith([Factuurnummer], "VND")
then
let
#"Invoked Custom Function1" = Table.AddColumn(#"Added Conditional Column", "11", each "1"),
#"Expanded Abonnementskosten" = Table.AddColumn(#"Invoked Custom Function1", "12", each "2")
in
#"Expanded Abonnementskosten"
else
let
Test = Table.AddColumn(#"Added Conditional Column", "Abonnementskosten", each "test")
in
Test

sjorshijgenaar_0-1618946423294.png

 

1 REPLY 1
MFelix
Super User
Super User

Hi @sjorshijgenaar ,

 

I'm calling out to one of the best super users on M language that can help you out.

 

@ImkeF can you help gving a path to have this working.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



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.