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
cwnoll
Frequent Visitor

Adding new column with multiple conditions (easy for most i am sure)

i am certain that this will be a simple answer, i am just totally drawing a blank.

 

my data looks like the following :

LocationDateTypeComplete

Texas

1/1/20199111
Texas10/9/20199110
New York6/7/2018Regular0
California6/7/2018Non 9111
New York7/25/2018Transfer1
New York2/2/2019Non 9111

 

what i am trying to accomplish is the following.

1) add new column that we will call productType

2) logic i am going after is this:

 

if location = Texas and Type = 911

   then "Emergency",

elseif location = New York && Type = Non 911

  then "Non-Emergency"

 

essentially I am trying to add a new column that looks at 1)what is the location 2)what is the type 3)set new column to whatever i put here

 

thoughts? Thanks so much in advance!

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi

In your table, select Add a new column 

 

if (AND(table1[location] = Texas ,table1[Type] = 911)  , "Emergency",IF(AND(table1[location] = "New York", table1[Type] = "Non 911"),"Non-Emergency"))

Hope this help

Tomas Santandreu Polanco |Principal Business Intelligence Consultant
www.designmind.com

View solution in original post

umanbr
Frequent Visitor

Try this:
NewColumn = SWITCH(true(),'Table'[state]="tx"&&'Table'[type]="911","Emergency",'Table'[state]="NewYork"&&'Table'[type]="911","Non-Emergency","Regular")

View solution in original post

3 REPLIES 3
umanbr
Frequent Visitor

Try this:
NewColumn = SWITCH(true(),'Table'[state]="tx"&&'Table'[type]="911","Emergency",'Table'[state]="NewYork"&&'Table'[type]="911","Non-Emergency","Regular")
Anonymous
Not applicable

Hi

In your table, select Add a new column 

 

if (AND(table1[location] = Texas ,table1[Type] = 911)  , "Emergency",IF(AND(table1[location] = "New York", table1[Type] = "Non 911"),"Non-Emergency"))

Hope this help

Tomas Santandreu Polanco |Principal Business Intelligence Consultant
www.designmind.com

thank you very much... as usual i try and over complicate things

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.

Top Solution Authors