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!View all the Fabric Data Days sessions on demand. View schedule
I have a list1 created from a text column in a table. I cleaned and trimed it. I manually created another list called "testlist" picking a few items from the list1. Then I used = List.PositionOf(CloseSEPcklist, testlist, Occurrence.First,Comparer.OrdinalIgnoreCase), the result is null. But when I used = List.Intersect({CloseSEPcklist, testlist}, Comparer.OrdinalIgnoreCase), the items all showed up. Can someone tell me what is going on here?
here is the original list1 pasted below and my testlist = {"10295", "12855", "12860", "12938"}
| 10295 |
| 12855 |
| 12860 |
| 12938 |
| 12842 |
| 10107 |
| 10291 |
| 10647 |
| 10649 |
| 10654 |
Solved! Go to Solution.
Hi @jimmyhua ,
Thanks for ronrsnfld's and AlienSx's replies!
And @jimmyhua ,
List.PositionOf: This function is designed to find the position of a single item in a list. When you pass testlist as the item, it does not find this collection of items in CloseSEPcklist , so the result is empty. The function is not designed to take a list as input to find the position of multiple items.
List.Intersect: This function works in your case because it is designed to find common items between two lists. Therefore, when you use List.Intersect({CloseSEPcklist, testlist}, Comparer.OrdinalIgnoreCase) , it correctly identifies the intersection of the two lists, i.e., the items that are present in both lists.
If you want to use List.PositionOf, you need to iterate over each item in testlist . Here is an example of how to do this using List.Transform and List.PositionOf:
let
CloseSEPcklist = {"10295", "12855", "12860", "12938", "12842", "10107", "10291", "10647", "10649", "10654"},
testlist = {"10295", "12855", "12860", "12938"},
positions = List.Transform(testlist, each List.PositionOf(CloseSEPcklist, _, Occurrence.First, Comparer.OrdinalIgnoreCase))
in
positions
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @jimmyhua ,
Thanks for ronrsnfld's and AlienSx's replies!
And @jimmyhua ,
List.PositionOf: This function is designed to find the position of a single item in a list. When you pass testlist as the item, it does not find this collection of items in CloseSEPcklist , so the result is empty. The function is not designed to take a list as input to find the position of multiple items.
List.Intersect: This function works in your case because it is designed to find common items between two lists. Therefore, when you use List.Intersect({CloseSEPcklist, testlist}, Comparer.OrdinalIgnoreCase) , it correctly identifies the intersection of the two lists, i.e., the items that are present in both lists.
If you want to use List.PositionOf, you need to iterate over each item in testlist . Here is an example of how to do this using List.Transform and List.PositionOf:
let
CloseSEPcklist = {"10295", "12855", "12860", "12938", "12842", "10107", "10291", "10647", "10649", "10654"},
testlist = {"10295", "12855", "12860", "12938"},
positions = List.Transform(testlist, each List.PositionOf(CloseSEPcklist, _, Occurrence.First, Comparer.OrdinalIgnoreCase))
in
positions
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Dino, thanks for explaning the results I am seeing. it has been great learning experience. Also thanks to ronrsnfld's and AlienSx's replies. They are all very helpful. Regards.
Assumption: Both List1 and testlist elements are text strings and not numbers.
If you are looking to see if any, or all, of the elements of testlist are within List1, you could use List.PositionOfAny.
When you use List.PositionOf, and the second argument is, itself, a list, you are looking for the position of that List (as a list) within list 1. In other words, the testlist would have to be one of the elements of List1. Something like:
List1= {{"10295", "12855", "12860", "12938"},"10295","12855","12860","12938","45678"}
The result of List.PositionOf(CloseSEPcklist, testlist, Occurrence.First,Comparer.OrdinalIgnoreCase) can't be null, it's impossible. It must be -1. Try to use
List.PositionOf(
CloseSEPcklist,
testlist,
Occurrence.First,
(c, v) => List.Contains(v, c)
)
List.PositionOf finds a position in the list (first agrument) when value (2nd argument) conforms to the equation criteria (4th argument). Your 4th argument is Comparer.OrdinalIgnoreCase. It compares each item of CloseSEPcklist (which is text) to the value argument (which is list). Read the manual of List.PositionOf.
yes. it is -1. I mean to say, it did not find the items. but it should right because I can see it.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 12 | |
| 7 | |
| 5 | |
| 5 | |
| 3 |