Forum Discussion

shahina14's avatar
shahina14
Icon for Microsoft Employee rankMicrosoft Employee
4 years ago
Solved

How do I pass my new measure value in calculated column through dax ?

I am trying to pass my new measure value which i have created .
That measure i am trying to pass while creating calculated column , but unfortunately the measure value is not retrieved.
Ex : measure_A = year(today()) - 3
ans = 2018

Newcolumn_A = switch(true(),
year('sample'[timePeriod])<[measure_A],0,1)

///where timeperiod is a column in my table.

  • Hi shahina14,

    You cannot pass a measure into a calculated column, as calculated columns are evaluated at data refresh time, whereas measures are evaluated as a result of user interaction within a report. Put simply: the value of a measure is not really known when a calculated column is evaluated.

    This article by Marco Russo (specifically the Choosing between calculated columns and measures section) is a very detailed deep-dive on the concepts and may help clarify further (as well as provide you with knowledge on how you may be able to approach your challenge differently).

    In terms of any follow-up and how to solve, you may get better traction by posting a question in the DAX or Desktop forums, as these have a lot more users with DAX-specific knowlegde and you are more likely to receive faster and more targeted assistance.

    Good luck,

    Daniel

1 Reply

  • dm-p's avatar
    dm-p
    Icon for Super User rankSuper User

    Hi shahina14,

    You cannot pass a measure into a calculated column, as calculated columns are evaluated at data refresh time, whereas measures are evaluated as a result of user interaction within a report. Put simply: the value of a measure is not really known when a calculated column is evaluated.

    This article by Marco Russo (specifically the Choosing between calculated columns and measures section) is a very detailed deep-dive on the concepts and may help clarify further (as well as provide you with knowledge on how you may be able to approach your challenge differently).

    In terms of any follow-up and how to solve, you may get better traction by posting a question in the DAX or Desktop forums, as these have a lot more users with DAX-specific knowlegde and you are more likely to receive faster and more targeted assistance.

    Good luck,

    Daniel