Forum Discussion
Wresen
1 year agoPost Patron
If statements between 2 tables , Power Query
Hi and thanks for reading this. i have looked around and i cant seem to find any answer for my problem not sure how easy or hard this is , have only been able to get true /false check to work 🙂 ...
- 1 year ago
Use this formula
let T1=Table.FromColumns({{1..5},{10,11,12,13,22}},{"ID","Value"}), T2=Table.FromColumns({{1,2,3,4,2},{5,6,11,1,7},{10,10,22,14,12},{"Green","BLue","BRown","Yellow","Red"}},{"ID","Check 1","Check 2","Return"}), #"Added Custom" = Table.AddColumn(T1, "Custom", each try Table.SelectRows(T2, (x)=> x[ID]=_[ID] and x[Check 1]<=_[Value] and x[Check 2]>=_[Value])[Return]{0} otherwise "Not Found") in #"Added Custom"For more descrition see this video:
https://www.youtube.com/watch?v=DHB2ejpEGxU
Wresen
1 year agoPost Patron
Hi Omid_Motamedise and Claude_Xu
Thanks Both for the help here . Really appriciate it 🙂
Omid_Motamedise
1 year agoSuper User
You are welcome
- Wresen1 year agoPost Patron
Omid_Motamedise
I see that this is not working when i have a Direct Query .Get an error that says that its not supported in DirectQ.
Is it possible to do this in Direct Q ??
The Fact table is important and the Table1 is a Direct Q/Thanks
- Omid_Motamedise1 year agoSuper User
Check this code, (it results in recodr, but just let me know does it work in Direct Query)
let T1=Table.FromColumns({{1..5},{10,11,12,13,22}},{"ID","Value"}), T2=Table.FromColumns({{1,2,3,4,2},{5,6,11,1,7},{10,10,22,14,12},{"Green","BLue","BRown","Yellow","Red"}},{"ID","Check 1","Check 2","Return"}), #"Added Custom" = Table.First(Table.AddColumn(T1, "Custom", each Table.SelectRows(T2, (x)=> x[ID]=_[ID] and x[Check 1]<=_[Value] and x[Check 2]>=_[Value])) ) in #"Added Custom"- Wresen1 year agoPost Patron
Hi Omid_Motamedise
it gives me someting strange Record Tools lights up 🙂
But not the error as before