Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
clarainesgg
Helper I
Helper I

Conditional Column PowerBi Editor

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

 

clarainesgg_0-1732116856515.png

 

Thanks!

 

Clara 

 

3 ACCEPTED SOLUTIONS
Jai-Rathinavel
Super User
Super User

Hi @clarainesgg Click on Custom Column and enter the below m code

 

JaiRathinavel_0-1732118080324.png

M Code:

if [name] = "gonzalez" then 15754
else if [name] = "perez" & [license_1] = 556 then 885
else [Medical_license_1]

 M Code snapshot:

 

JaiRathinavel_2-1732118284064.png

 

Did I answer your question? If yes, please mark my post as a solution.

 

Thanks,

Jai




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

Bibiano_Geraldo
Super User
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.

 

View solution in original post

Anonymous
Not applicable

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]))

 

vjialongymsft_0-1732171035641.png

 

 

 

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

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]))

 

vjialongymsft_0-1732171035641.png

 

 

 

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Bibiano_Geraldo
Super User
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.

 

Jai-Rathinavel
Super User
Super User

Hi @clarainesgg Click on Custom Column and enter the below m code

 

JaiRathinavel_0-1732118080324.png

M Code:

if [name] = "gonzalez" then 15754
else if [name] = "perez" & [license_1] = 556 then 885
else [Medical_license_1]

 M Code snapshot:

 

JaiRathinavel_2-1732118284064.png

 

Did I answer your question? If yes, please mark my post as a solution.

 

Thanks,

Jai




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors