I created a conditional column using dax programming to transform inches to centimeters. However, I must take place in Transform Column. I googled that it is M Code. Do you know how this code would look like in M Code? The intention is to create the column conditonal_column if column_a is I then col_b should be multiplied by 2.45. If it is M then do not make the multiplication.
conditional_column = IF(data[col_a] = "I", data[col_b] * 2.54, data[col_b])
This is my table
|col_a| col_b|
|-----|------|
| I |0.4 |
| M |0.6 |
| I |0.12 |
| M |0.18 |
Expected Result
|col_a| col_b| conditional_column|
|-----|------| ------------------|
| I |0.4 |0.10 |
| M |0.6 |0.6 |
| I |0.12 |0.30 |
| M |0.18 |0.18 |
>Solution :
Add a new column and type in the following:
if [col_a] = "I" then [col_b] * 2.54 else [col_b]
