Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I want to create a 3rd column (New Name) with revised names for Test 1 in Name column. For Test1, I want this to be named Test A IF Basket column is equal to xray1 or xray2. But if the Basket is qual1 or qual 2, I want the new name to be Test B. I want to keep the Test2 name the same. Can you help with the formula? Thanks!
Name | Basket | New Name |
Test1 | xray1 | TestA |
Test2 | bob | Test2 |
Test1 | xray2 | TestA |
Test2 | bob | Test2 |
Test1 | qual1 | TestB |
Test2 | bob | Test2 |
Test1 | qual2 | TestB |
Test2 | bob | Test2 |
Solved! Go to Solution.
Could also be:
Column =
SWITCH(
TRUE(),
LEFT(TableName[Basket],4) = "xray", "TestA",
LEFT(TableName[Basket],4) = "qual", "TestB",
FORMAT(TableName[Name],"0")
)
It's really hard for me to know what data types you're dealing with if they are not in your sample.
Proud to be a Super User!
Try as:
Column =
SWITCH(
TRUE(),
LEFT(TableName[Basket],4) = "xray", "TestA",
LEFT(TableName[Basket],4) = "qual", "TestB",
TableName[Name]
)
Proud to be a Super User!
I tried this but got "Function 'SWITCH' does not support comparing values of type True/False with values of type Number. Consider using the VALUE or FORMAT function to convert one of the values." What does the 4 do?
So your sample was not representative (data types) of your actual data? My guess is try:
Column =
SWITCH(
TRUE(),
LEFT(TableName[Basket],4) = "xray", "TestA",
LEFT(TableName[Basket],4) = "qual", "TestB",
VALUE(TableName[Name])
)
or maybe this:
Column =
SWITCH(
TRUE(),
LEFT(VALUE(TableName[Basket]),4) = "xray", "TestA",
LEFT(VALUE(TableName[Basket]),4) = "qual", "TestB",
TableName[Name]
)
or all of both of them combined.
Proud to be a Super User!
Could also be:
Column =
SWITCH(
TRUE(),
LEFT(TableName[Basket],4) = "xray", "TestA",
LEFT(TableName[Basket],4) = "qual", "TestB",
FORMAT(TableName[Name],"0")
)
It's really hard for me to know what data types you're dealing with if they are not in your sample.
Proud to be a Super User!
THe first one worked, I just changed the number to the actual length of the word. Thanks!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
94 | |
77 | |
65 | |
53 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |