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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
cottrera
Post Prodigy
Post Prodigy

Power Query IF Statement

Hi 

 

I have a table with the following columns Ref, VAT Code, VAT Amount, VAT Amount query119. The table is 100,000 rows long and will continue to grow. I need to create a custom column in power query with an IF Statement to do the following

 

IF VAT Code = F2 then VAT Amount Query 119 else VAT Amount

 

I have tried many different combinations but keep receiving an error

Journal RefVAT CodeVAT  AmountVAT Amount - Query 119
1084523D001313
1099880D0040
1033875F20247
1056924F2033
1071960F202438
1075097F20400
1075411F20400
1098041F3015
1109724F3031
1109728F3011
1101111F0204204
1104774F901061
1077322N00145
1071910N21977
1077211N2793286
1077322N21872
1118252NN040
1148406NN040
1077322P262145
1083805P21963974
1091893P2233613979
1094075P210582004
343434P3113113

 

thank you

 

Richard

1 ACCEPTED SOLUTION
manikumar34
Solution Sage
Solution Sage

@cottrera , Use conditional column which uses IF , Then and else .





If this helps, Appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




View solution in original post

6 REPLIES 6
Tahreem24
Super User
Super User

@cottrera ,

Go to Power Query --> Add Column Menu --> Click on Conditional Column and fill like below:

 

Capture.JPG

 

Or Else you can do it using DAX column like below:

DAX Column = IF(Sheet2[VAT Code]="F2",(Sheet2[VAT Amount - Query 119]),(Sheet2[VAT  Amount]))
 
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Hi  Thank you for your response you suggestion worked perfectly. Unfortunatly someone answered before you and I marked them as resolved

RIchard

manikumar34
Solution Sage
Solution Sage

@cottrera , Use conditional column which uses IF , Then and else .





If this helps, Appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




Thank you manikumar34 for your quick reponse. I always answer in order of who contacted me by date and time. Your option worked aso marked as solution

Richard 

Anonymous
Not applicable

@cottrera Add custom column with this code:

if [VAT Code]="F2" then [#"VAT Amount"] else [#"VAT Amount - Query 119"]

Hi Marik thank you for your quick response. I tried the customer column method but received and error

cottrera_0-1632915501215.png

So I then tried manikumar34 option.
thank you anyway

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.