Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello,
I have two tables, where i need to create a custom column in table1 with Xlookup and if condition as below in power query.
Any suggestion is appreciated!
XLOOKUP(Table1[Acct],IF(Table1[Code]="10",Table2[ID],Table2[Reg]),Table2[Result],"",0) - as excel formula
@amitchandak @Greg_Deckler any idea ?
PFB, example
Solved! Go to Solution.
Yes, you can do it in power query
For it
watch my video here
https://1drv.ms/v/s!AiUZ0Ws7G26RhkVJy1BzMCewswHT?e=IhiBz9
Sample PBIX file attached
https://1drv.ms/u/s!AiUZ0Ws7G26RhkSmF2LtunIY-yJ1?e=wcPPjd
Yes, you can do it in power query
For it
watch my video here
https://1drv.ms/v/s!AiUZ0Ws7G26RhkVJy1BzMCewswHT?e=IhiBz9
Sample PBIX file attached
https://1drv.ms/u/s!AiUZ0Ws7G26RhkSmF2LtunIY-yJ1?e=wcPPjd
1) creat new tabl
Table = ALLSELECTED('Table_1'[Acct],Table_1[Code])
or
Newtable = VALUES(Table_1)
2) add column
Column =
IF([Code]=10, CALCULATE(MAX('Table_2'[Result]),FILTER(ALL(Table_2),'Table_2'[ID]=[Acct])),
CALCULATE(MAX('Table_2'[Result]),FILTER(ALL(Table_2),'Table_2'[Reg]=[Acct]))
)
is there any possible way in power query itself ?