Forum Discussion
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 Ref | VAT Code | VAT Amount | VAT Amount - Query 119 |
| 1084523 | D0 | 0 | 1313 |
| 1099880 | D0 | 0 | 40 |
| 1033875 | F2 | 0 | 247 |
| 1056924 | F2 | 0 | 33 |
| 1071960 | F2 | 0 | 2438 |
| 1075097 | F2 | 0 | 400 |
| 1075411 | F2 | 0 | 400 |
| 1098041 | F3 | 0 | 15 |
| 1109724 | F3 | 0 | 31 |
| 1109728 | F3 | 0 | 11 |
| 1101111 | F0 | 204 | 204 |
| 1104774 | F9 | 0 | 1061 |
| 1077322 | N0 | 0 | 145 |
| 1071910 | N2 | 19 | 77 |
| 1077211 | N2 | 793 | 286 |
| 1077322 | N2 | 18 | 72 |
| 1118252 | NN | 0 | 40 |
| 1148406 | NN | 0 | 40 |
| 1077322 | P2 | 62 | 145 |
| 1083805 | P2 | 1963 | 974 |
| 1091893 | P2 | 2336 | 13979 |
| 1094075 | P2 | 1058 | 2004 |
| 343434 | P3 | 113 | 113 |
thank you
Richard
cottrera , Use conditional column which uses IF , Then and else .
6 Replies
- AnonymousNot applicable
cottrera Add custom column with this code:
if [VAT Code]="F2" then [#"VAT Amount"] else [#"VAT Amount - Query 119"]
- cottreraPost Prodigy
Hi Marik thank you for your quick response. I tried the customer column method but received and error
So I then tried manikumar34 option.
thank you anyway
- manikumar34Solution Sage
cottrera , Use conditional column which uses IF , Then and else .
- cottreraPost Prodigy
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