Forum Discussion
Mikey_surreall
3 years agoNew Member
power query cycle through data in another table using M Formulas
HI All I can't wrap my head round this. In Trasform data, add custome column .. m query. I have table A, with values like 157, 975, 433 in Col A. I have table B, with values like 150, 250, 4...
- 3 years ago
You can add a custom column in Table A with below code. Notice that 975 would not return 1000 as "1000 - 975 = 25".
let pColAValue = [Col A] in List.First(List.Select(#"Table B"[Col B], each pColAValue >= _ - 20 and pColAValue <= _ + 20))Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Mikey_surreall
3 years agoNew Member
You are a genius! Thank you so much for that, worked a treat.
List.select, gets all the occurences? And then list.first selects the first of that list?
Rgds
Mikey
v-jingzhang
3 years agoCommunity Support
Yes, you are correct!