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

Contains

Hello everyone,

 

What DAX formula i can use the same with the one I'm using in Tableau calculations. Please see example for my tableau calculation:

 

 

IF CONTAINS([ColumnsA], "Apples")

OR CONTAINS([Column A], "Orange")

THEN "Fruits"

ELSEIF

IF CONTAINS([ColumnsA], "Spinach")

OR CONTAINS([Column A], "Potato")

THEN "Vegetables"

ELSE "Herbs" END


Your help would be appreciated. Thank you

2 ACCEPTED SOLUTIONS
SamInogic
Super User
Super User

Hi @Jedahn,

You can use below DAX expression to create a column in a table:

Column = If(CONTAINSSTRING('Sample'[Column A], "Apples") || CONTAINSSTRING('Sample'[Column A], "Orange") , "Fruits",

IF(CONTAINSSTRING('Sample'[Column A], "Spinach") || CONTAINSSTRING('Sample'[Column A], "Potato") ,"Vegetables","Herbs"))

 

Please refer to the below screenshot,

 

SamInogic_0-1676001481989.png


If this answer helps, please mark it as Accepted Solution so it would help others to find the solution.


Thanks!

Inogic Professional Service Division

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop an email at crm@inogic.com

Service:  http://www.inogic.com/services/ 

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

View solution in original post

Hi @Jedahn,

Yes, "Sample" is a Table name in the Power BI report. Please find reference screenshot of the Power Query for Table :

SamInogic_0-1676026390151.png

 

Thanks!

Inogic Professional Service Division

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop an email at crm@inogic.com

Service:  http://www.inogic.com/services/ 

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

View solution in original post

4 REPLIES 4
wdx223_Daniel
Super User
Super User

NewColumn=SWITCH(TRUE(),Table[ColumnA] IN {"Apples","Orange"},"Fruits",Table[ColumnA] IN {"Spinach","Potato"},"Fruits","Herbs")

SamInogic
Super User
Super User

Hi @Jedahn,

You can use below DAX expression to create a column in a table:

Column = If(CONTAINSSTRING('Sample'[Column A], "Apples") || CONTAINSSTRING('Sample'[Column A], "Orange") , "Fruits",

IF(CONTAINSSTRING('Sample'[Column A], "Spinach") || CONTAINSSTRING('Sample'[Column A], "Potato") ,"Vegetables","Herbs"))

 

Please refer to the below screenshot,

 

SamInogic_0-1676001481989.png


If this answer helps, please mark it as Accepted Solution so it would help others to find the solution.


Thanks!

Inogic Professional Service Division

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop an email at crm@inogic.com

Service:  http://www.inogic.com/services/ 

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

Thank you for the reply. What does the 'Sample' in formula means? Is it the Table name or column name?

Hi @Jedahn,

Yes, "Sample" is a Table name in the Power BI report. Please find reference screenshot of the Power Query for Table :

SamInogic_0-1676026390151.png

 

Thanks!

Inogic Professional Service Division

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop an email at crm@inogic.com

Service:  http://www.inogic.com/services/ 

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.