Question: I´ve been struggling with this:

![enter image description here](https://i.stack.imgur.com/gVzSf.png)

My table shows 3 records but when expanding there are like 100 columns. I used this code:

```
#"Expanded Data" = Table.ExpandTableColumn(#"Source", "Document", List.Union(List.Transform(#"Source"[Document]), each Table.ColumnNames(_))),

```

but it's not working. How can I expand simultaneously all columns? Also, inside those columns there are even more, for example I expand the first time end then those new columns have more records inside.

What could I do? Thanks in advance!

Answer: 
Well you need to modify your code as following as it is more optimised:

```

def twoStrings(s1, s2):
    UniqueChar_S1 = set(s1)
    UniqueChar_S2 = set(s2)

    for i in UniqueChar_S1:
        if i in UniqueChar_S2:
            return "YES"

    return "NO"

```
UniqueChar\_S1 = (char for char in s1) is a generator.

```
for i in set(UniqueChar_S1):
    if i in set(UniqueChar_S2):

```

So after checking the 'if' condition once the value of set(UniqueChar\_S2) would be empty for second iteration.

So i suggest you the following code:

```
def twoStrings(s1, s2):
    SubStringExists = set(s1)&set(s2)
    return "YES" if SubStringExists else "NO"

```