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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.