This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowJuly 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more
Hi,
I did a conditional column with one field. However, I need to add another clause AND in the second clause.
if "Name"="gonzalez" then 15754
else if name="perez "and license_1=556 then 885
else Medical_lincense
Thanks!
Clara
Solved! Go to Solution.
Hi @clarainesgg Click on Custom Column and enter the below m code
M Code:
if [name] = "gonzalez" then 15754
else if [name] = "perez" & [license_1] = 556 then 885
else [Medical_license_1]M Code snapshot:
Did I answer your question? If yes, please mark my post as a solution.
Thanks,
Jai
Proud to be a Super User! | |
Hi @clarainesgg
In power query, on your last step, right and insert step after and in formula bar paste this code:
= Table.AddColumn(PreviousStepName, "Custom Column", each
if [Name] = "gonzalez" then 15754
else if [Name] = "perez" and [license_1] = 556 then 885
else [Medical_lincense]
)
Replace PreviousStepName with the name of your previous step. If the step name contains spaces or special characters, enclose it in # and double quotes (#"Step Name").
Additionally, ensure you replace the column names (Name, license_1, and Medical_lincense) with the actual column names from your tabl e.
Hi @clarainesgg
You can also choose to use Dax to meet your needs.
license = IF([Name]="gonzalez", 15754,IF( [Name] ="perez" && [license_1] =556 , 885 ,[Medical_lincense]))
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @clarainesgg
You can also choose to use Dax to meet your needs.
license = IF([Name]="gonzalez", 15754,IF( [Name] ="perez" && [license_1] =556 , 885 ,[Medical_lincense]))
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @clarainesgg
In power query, on your last step, right and insert step after and in formula bar paste this code:
= Table.AddColumn(PreviousStepName, "Custom Column", each
if [Name] = "gonzalez" then 15754
else if [Name] = "perez" and [license_1] = 556 then 885
else [Medical_lincense]
)
Replace PreviousStepName with the name of your previous step. If the step name contains spaces or special characters, enclose it in # and double quotes (#"Step Name").
Additionally, ensure you replace the column names (Name, license_1, and Medical_lincense) with the actual column names from your tabl e.
Hi @clarainesgg Click on Custom Column and enter the below m code
M Code:
if [name] = "gonzalez" then 15754
else if [name] = "perez" & [license_1] = 556 then 885
else [Medical_license_1]M Code snapshot:
Did I answer your question? If yes, please mark my post as a solution.
Thanks,
Jai
Proud to be a Super User! | |
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 25 | |
| 23 | |
| 19 | |
| 17 | |
| 14 |
| User | Count |
|---|---|
| 25 | |
| 23 | |
| 20 | |
| 20 | |
| 19 |