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
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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.