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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Custom column with condition from other column

= Table.AddColumn(#"Replaced Value", "NewColumn", each if [ID] = "A12153" then [Type] ="Hard" else [Type])

 

The result for ID displays FALSE.

 

-- i am looking similar to below in power bi.

 

update table set Type = "Hard"  where ID = "A12153"

 

Need help. Thanks for looking

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

I think you want to change the values in Type column to "Hard" if the ID = A12153, and other ID will keep the values in Type column.

I build a sample table to have a test.

1.png

You can try Conditional column in Add column.

2.png

Remove Type column and rename the new column, result is as below.

3.png

Or you can copy my M Query and paste it into Advanced Editor.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjQ0MjQ1VtJRclSK1YFyTYBcJwTXHMh1RnBBioMRXDMg1wVV1lUpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Type = _t]),
    #"Added Conditional Column" = Table.AddColumn(Source, "Custom", each if [ID] = "A12153" then "Hard" else [Type]),
    #"Removed Columns" = Table.RemoveColumns(#"Added Conditional Column",{"Type"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Custom", "Type"}})
in
    #"Renamed Columns"

 You can download the pbix file from this link: Custom column with condition from other column

 

Best Regards,

Rico Zhou

 

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 @Anonymous 

I think you want to change the values in Type column to "Hard" if the ID = A12153, and other ID will keep the values in Type column.

I build a sample table to have a test.

1.png

You can try Conditional column in Add column.

2.png

Remove Type column and rename the new column, result is as below.

3.png

Or you can copy my M Query and paste it into Advanced Editor.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjQ0MjQ1VtJRclSK1YFyTYBcJwTXHMh1RnBBioMRXDMg1wVV1lUpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Type = _t]),
    #"Added Conditional Column" = Table.AddColumn(Source, "Custom", each if [ID] = "A12153" then "Hard" else [Type]),
    #"Removed Columns" = Table.RemoveColumns(#"Added Conditional Column",{"Type"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Custom", "Type"}})
in
    #"Renamed Columns"

 You can download the pbix file from this link: Custom column with condition from other column

 

Best Regards,

Rico Zhou

 

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

amitchandak
Super User
Super User

@Anonymous , The part should be like

if [ID] = "A12153" then"Hard" else [Type]

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Sumanth_23
Memorable Member
Memorable Member

hi @Anonymous - Let me know if this the desired output you are looking to achieve. 

 

Status = IF ('ID-Data'[ID] = "A12153", "Hard")

Sumanth_23_0-1600369900977.png

 

Please mark the post as a solution and provide a 👍 if my comment helped with solving your issue. Thanks!

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

Proud to be a Super User!



Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors