The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
I have two columns which Code and Names. I want to add a calculated column which should be assigned a number based on a condition that
if Code = A and Name = B then 1,
if Code = C and Name = D then 2,
if Code = E and Name = F then 3,
if Code = G and Name = H then 4
How can I implement this in Power BI?
Thanks in advance.
Solved! Go to Solution.
CalculatedColumn =
SWITCH(
TRUE(),
'Table'[Code] = "A" && 'Table'[Names] = "B", 1,
'Table'[Code] = "C" && 'Table'[Names] = "D", 2,
'Table'[Code] = "E" && 'Table'[Names] = "F", 3,
'Table'[Code] = "G" && 'Table'[Names] = "H", 4,
BLANK()
)
If your requirement is solved, please make THIS ANSWER a SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.
Hello @bhargavanand . Thank you for finding my suggestion a Solution for your need. Please hit the LIKE 👍 button if it has helped you.
CalculatedColumn =
SWITCH(
TRUE(),
'Table'[Code] = "A" && 'Table'[Names] = "B", 1,
'Table'[Code] = "C" && 'Table'[Names] = "D", 2,
'Table'[Code] = "E" && 'Table'[Names] = "F", 3,
'Table'[Code] = "G" && 'Table'[Names] = "H", 4,
BLANK()
)
If your requirement is solved, please make THIS ANSWER a SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
21 | |
20 | |
18 | |
17 | |
12 |
User | Count |
---|---|
41 | |
38 | |
24 | |
20 | |
20 |