Forum Discussion
EricKautz
Helper I
2 years agocreate column with multiple if/or
I have a column that has different asset class names (FX, InterestRate, Commodity, and Unspecified). I want to create a new column with the below if statement. If Asset Class = "FX" then "FX" or...
ryan_mayu
Super User
2 years agoyou can try this in Power query
if [Asset Class]="FX" then "FX" else if [Asset Class]="InterestRate" then "InterestRate" else if [Asset Class] = "Commodity" then "Commodity" else if [Asset Class]="Unspecified" and [Trade ID]>="11111111" and [Trade ID]<"99999999" then "Commodity" else null
i used double quotation marks for number because I didn't change it to number. If I did that, the first number in the Trade ID will display in different type. If the Trade ID column is in number type in your real data. Then you just remove the double quotation marks in the M code.
EricKautz
Helper I
2 years agoCould you post the actual dax formula you used.