Question: I need to do the following:

I have some instances that contain a certain tag, I need to loop through those instances and for each instance which contains that certain tag, if that instance has an elastic ip attached, I need to tag that elastic ip with that same tag. My code is the following:

```
import boto3
import json

region_list = ['us-east-1']
session = boto3.Session(profile_name='default')

for region in region_list:
    ec2 = session.resource('ec2',region)
    client = boto3.client('ec2',region)
    # Retrieve instances that contain this specific tag
    instances = ec2.instances.filter(Filters=[{'Name':'tag:MyTargetTag', 'Values':['*']}])

    for instance in instances:
        for tag in instance.tags:
            if tag['Key'] == "MyTargetTag":
                MyTargetTag = tag['Value']
        ## check if this instance has an elasticip
        ## if it has, assign the value of MyTargetTag to it
        response = client.add_tags(
            ResourceArns=[
                #elasticip ip identifier of some sort,
            ],
            Tags=[
                {
                    'Key': 'MyTargetTag',
                    'Value': MyTargetTag
                },
            ]
        )

```

I've read through the docs and videos and what not but honestly I don't understand it quite completely and I'm just doing trial and error without any success.

Answer: 
The reason you are getting "Expression.Error: The name..." errors is because your are trying to enter DAX formulas in Power Query editor. Power Query uses a different language called "M", and does not recognize DAX. You can solve this problem in 2 ways:

1) Exit query editor, and in PowerBI window, go to tab "Modeling" and create "New Column". Enter DAX formulas there;

2) If you prefer to solve the problem in Power Query, create a custom column there and enter this "M" formula:

```
each List.First(List.RemoveNulls({[PIDISK], [PI_DISK]}), "No Disk Entered"))

```

How the formula works: List.RemoveNulls removes nulls from the list of columns you provide. Then it picks the first value from the result; if there is none, it uses default option ("no disk entered"). Just make sure that your NULLs are really nulls.
Whats up? Either of these should work depending on whether or not you have "null" strings or blank() values:

"null"

```
New Column =
SWITCH (
    TRUE (),
    AND ( [PIDISC] = "null", [PI_DISC] = "null" ), "NO DISC ENTERED",
    [PIDISC] = "null", [PI_DISC],
    [PI_DISC] = "null", [PIDISC]
)

```

Tested:

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

BLANK()

```
New Column =
SWITCH (
    TRUE (),
    AND ( ISBLANK([PIDISC]), ISBLANK([PI_DISC]) ) , "NO DISC ENTERED",
    ISBLANK ( [PIDISC] ), [PI_DISC],
    ISBLANK ( [PI_DISC] ), [PIDISC]
)

```

Hope this helps!