Hi there,
I'm trying to solve a puzzle using power query. I'd like to create a custom column that returns the values "yes" or "no" depending on the values in several other columns. If the Year Since NPF column = "1" and the 1 column = "y" my custom column should return "yes" and so on.
I have tried using the following code"
if [Years since NPF] = 1 or 2 then "yes"
else if [Years since NPF] = 3 and [3] = "y" then "yes"
else if [Years since NPF] = 4 and [4] = "y" then "yes"
else if [Years since NPF] = 5 and [5] = "y" then "yes"
else if [Years since NPF] = 6 and [6] = "y" then "yes"
else if [Years since NPF] = 7 and [7] = "y" then "yes"
else if [Years since NPF] = 8 and [8] = "y" then "yes"
else if [Years since NPF] = 9 and [9] = "y" then "yes"
else if [Years since NPF] = 10 and [10] = "y" then "yes"
else if [Years since NPF] = 11 and [11] = "y" then "yes"
else if [Years since NPF] = 12 and [12] = "y" then "yes"
else if [Years since NPF] = 13 and [13] = "y" then "yes"
else if [Years since NPF] = 14 and [14] = "y" then "yes"
else if [Years since NPF] = 15 and [15] = "y" then "yes"
else if [Years since NPF] = 16 and [16] = "y" then "yes"
else if [Years since NPF] = 17 and [17] = "y" then "yes"
else if [Years since NPF] = 18 and [18] = "y" then "yes"
else if [Years since NPF] = 19 and [19] = "y" then "yes"
else if [Years since NPF] = 20 and [20] = "y" then "yes"
else "no"
but get an error saying "Expression. Error: We cannot convert the value "2" to type Logical.
Details:
Value=2
Type=Type"
Here is an example of my data below:
I realize this might be very simple but any help would be SO appreciated! Thank you!
I'm trying to solve a puzzle using power query. I'd like to create a custom column that returns the values "yes" or "no" depending on the values in several other columns. If the Year Since NPF column = "1" and the 1 column = "y" my custom column should return "yes" and so on.
I have tried using the following code"
if [Years since NPF] = 1 or 2 then "yes"
else if [Years since NPF] = 3 and [3] = "y" then "yes"
else if [Years since NPF] = 4 and [4] = "y" then "yes"
else if [Years since NPF] = 5 and [5] = "y" then "yes"
else if [Years since NPF] = 6 and [6] = "y" then "yes"
else if [Years since NPF] = 7 and [7] = "y" then "yes"
else if [Years since NPF] = 8 and [8] = "y" then "yes"
else if [Years since NPF] = 9 and [9] = "y" then "yes"
else if [Years since NPF] = 10 and [10] = "y" then "yes"
else if [Years since NPF] = 11 and [11] = "y" then "yes"
else if [Years since NPF] = 12 and [12] = "y" then "yes"
else if [Years since NPF] = 13 and [13] = "y" then "yes"
else if [Years since NPF] = 14 and [14] = "y" then "yes"
else if [Years since NPF] = 15 and [15] = "y" then "yes"
else if [Years since NPF] = 16 and [16] = "y" then "yes"
else if [Years since NPF] = 17 and [17] = "y" then "yes"
else if [Years since NPF] = 18 and [18] = "y" then "yes"
else if [Years since NPF] = 19 and [19] = "y" then "yes"
else if [Years since NPF] = 20 and [20] = "y" then "yes"
else "no"
but get an error saying "Expression. Error: We cannot convert the value "2" to type Logical.
Details:
Value=2
Type=Type"
Here is an example of my data below:
Years since NPF | Plant Species | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
1 | Norway Maple | y | y | Y | y | ||||||||||||||||
4 | Norway Maple | y | y | Y | y | ||||||||||||||||
1 | Norway Maple | y | y | Y | y | ||||||||||||||||
10 | Norway Maple | y | y | Y | y | ||||||||||||||||
1 | Norway Maple | y | y | Y | y | ||||||||||||||||
3 | Norway Maple | y | y | Y | y | ||||||||||||||||
2 | Norway Maple | y | y | Y | y | ||||||||||||||||
4 | Pineapple Weed | y | y | y | y | y | y | y | |||||||||||||
7 | Pineapple Weed | y | y | y | y | y | y | y | |||||||||||||
2 | Pineapple Weed | y | y | y | y | y | y | y | |||||||||||||
2 | Pineapple Weed | y | y | y | y | y | y | y | |||||||||||||
5 | Pineapple Weed | y | y | y | y | y | y | y | |||||||||||||
1 | Pineapple Weed | y | y | y | y | y | y | y | |||||||||||||
2 | Pineapple Weed | y | y | y | y | y | y | y | |||||||||||||
2 | Pineapple Weed | y | y | y | y | y | y | y | |||||||||||||
2 | Pineapple Weed | y | y | y | y | y | y | y | |||||||||||||
11 | Yellow hawkweed | y | y | y | y | y | y | y | |||||||||||||
7 | Yellow hawkweed | y | y | y | y | y | y | y | |||||||||||||
3 | Yellow hawkweed | y | y | y | y | y | y | y | |||||||||||||
7 | Yellow hawkweed | y | y | y | y | y | y | y |
I realize this might be very simple but any help would be SO appreciated! Thank you!