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
Anonymous
Not applicable

If statement in order to create new column

I have table that looks like this:

idActityvityDevice
1RelaxMobile
2HyperPC
3Laid BackMobe
4RelaxMobile
5HyperPC
6Laid BackMobile

I'm trying to create a new caloumn by applying the If statement in Dax, to say: IF Activity = Relax And Device= Mobile Then 1.

What the best way to go about it.

 

Thanks

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

 

Create a New Column

 

New Column = SWITCH(
TRUE(),
'Table'[Actityvity] = "Relax" && 'Table'[Device] = "Mobile",1
)
 
1.jpg
 
 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

3 REPLIES 3
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

 

Create a New Column

 

New Column = SWITCH(
TRUE(),
'Table'[Actityvity] = "Relax" && 'Table'[Device] = "Mobile",1
)
 
1.jpg
 
 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

mahoneypat
Microsoft Employee
Microsoft Employee

Are you trying to make a calculated column or a measure?  If a column, you can use this expression (substitute the name of your table for 'Table')

 

NewColumn = if(AND(Table[Activity]="Relax", Table[Device]="Mobile"), 1, 0)

 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi mohoneypat,

unfortunately, using this dax isn't recognizing my table. 

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.