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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.