Forum Discussion

vincentakatoh's avatar
vincentakatoh
Helper IV
9 years ago

Custom Column (M) vs New Column (DAX)

Hi, 

From a system resource perspective, can advise which takes less resource, Custom Column vs New Column. 

 

- Understand Custom Column is M lang and New Column is DAX.

- Also read that a Measure is always preferred to New Column from a system resource perspective. 

- Eg. If I have a column with Pass and Fail, and need to replace with 1 and 0, should i use Custom Column or New Column? Actual data has millions of row so, resource optimisation is important. 

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    My understanding is that M is faster, thus if you can do it in M you should.

     

    As for Column vs Measure, if you can do something as a measure then you should.  This is because measures are calculated at run time and are an aggregate of all of the data. Think of a column as inserting a value into each row of the table, where as a measure is like a single cell of an excel sheet that calculates based on current context.

    Going to your example, if you need a Pass/Fail column which you will use for filtering, you will need a column to store this.  This will be calculated at the time your data is refreshed.  So if you can do that in M, do it that way.

    Alternatively, if your Pass/Fail is context sensitive or relies on data from multiple rows, you can place this logic into a measure to either filter it out or in.  This would be in the form of wrapping your DAX statement in a CALCULATE(<your dax logic>, <filtering>).  So for a pass/fail, you would have a pass metric and a fail metric.