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

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.

Reply
Anonymous
Not applicable

Same If function for several columns to populate a new column

Hi,

 

I have this table with Client info about an assessment. In the table 56 columns has fields that has 0,1,2,3 value, where 0,1 represents Nonactionable & 2,3 represents Actionable.

 

I am trying to create a new Column thet will have Actionable & Nonactionable category based on the numbers in those 56 Columns.

I am doing it by adding a conditional column (See the Image), this way I have to create 224 conditions...Conditional Column.JPG

My question is , is there a simple way to do this?

Thanks,

panda2018

 

 

1 ACCEPTED SOLUTION

@Anonymous -

Something like 

= Table.AddColumn(#"Changed Type", "Custom", each if [Column1] = 0 or [Column1] = 1 then "Action" else if [Column1] = 2 or [Column1] = 3 then "Non" else "N/A")





Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



View solution in original post

7 REPLIES 7
Nathaniel_C
Super User
Super User

@Anonymous ,

See the pics... First you could change the Operator, which it cuts it to 2 conditions. You could add a third if you want to test other numbers. Just do one column, and see the second picture, you can see the code. Copy the code and paste it for as many columns as you have, or using the interface may be easier. Or use Chris' suggestion.

 

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

Conditional column.PNG

 

Conditional column2.PNG





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

Proud to be a Super User!




Anonymous
Not applicable

Thank you!! 

Actually here the 0 has a value & If the field is completely empty I wanted to replace it with Not Applicable.

I figured it out.

Thanks!!

ChrisMendoza
Resident Rockstar
Resident Rockstar

@Anonymous -

My guess is that you should unpivot the columns and then write an IF ( OR ( 1, 2), "NonActionable", "Actionable" )






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Anonymous
Not applicable

Thank you @ChrisMendoza so much!! 

So If I have no Value & I want to replace with N/A wht should be my statement?

@Anonymous -

Something like 

= Table.AddColumn(#"Changed Type", "Custom", each if [Column1] = 0 or [Column1] = 1 then "Action" else if [Column1] = 2 or [Column1] = 3 then "Non" else "N/A")





Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Anonymous
Not applicable

Thank you so much @ChrisMendoza !! Perfect..

I just did a conditional column..

 

Conditional Column.JPG

Hi @Anonymous 

 

Glad to know you have fixed the issue, could you plz kindly mark the helpful answer as a solution? that help others find it more quickly. thanks!

 

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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