Forum Discussion
EricKautz
2 years agoHelper I
create 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
2 years agoSuper User
you 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
2 years agoHelper I
Could you post the actual dax formula you used.