Data Model - Formula not working

michael8000

New Member
Joined
Mar 10, 2014
Messages
27
I'm trying to pull out a specific word from my Data Model. I added a new column and this formula works in regular excel but not in the Data Model. Anyone have any ideas why its not working?

My goal is to have only single word "Adobe" on the type column (type column was just added)

1575577653040.png

1575577750545.png

1575577783728.png
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
or
CustomColumn = IF(ISERROR(SEARCH("Adobe", TableName[ColumnName])),"X","Y")
 
Upvote 0
That is just adding Adobe to ALL rows, even when it does not have the word "Adobe" in the cell it's searching against

1575583270899.png

1575583281346.png
 
Upvote 0
CONTAINS doesn't work unfortunately :(
if you want to try start typing =IF(CONTAINS( and select table name from the dropdown list

Edit:
I am too slow or you are too fast :)
try post#4 or maybe use PowerQuery instead of DataModel?
 
Upvote 0
PowerQuery - M-code, eg. = Table.AddColumn(Type, "Custom", each if Text.Contains([Item], "Apple") then "Apple" else "Misc")
 
Upvote 0
with DAX:
Column = IF(CONTAINSSTRING([Item],"Apple"),"X","Z")
ItemSale PriceDate SoldColumn
Apple305/03/2017X
Orange512/05/2018Z
Apple711/04/2017X
Orange430/06/2018Z
Banana405/04/2019Z
Pear631/07/2019Z
Banana511/05/2019Z


but be aware CONTAINSSTRING function is available in newer version, so try PowerBI
 
Upvote 0

Forum statistics

Threads
1,213,521
Messages
6,114,109
Members
448,548
Latest member
harryls

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top