Forum Discussion

Hoping's avatar
Hoping
Icon for Helper III rankHelper III
11 months ago
Solved

Does a measure automatically wrapped inside CALCULATE in Calculated Column?

I am learning DAX and trying to understand Context transition and behaviour of Calculate. Conside the scenario where I am creating a calculated column and using a measure to create it.

 

Does DAX wrap the measure in CALCULATE automatically (which we can't see) ?  Or are we saying it behave as if it is wrapped inside CALCULATE but really it is not?  I also see statements that CALCULATE triggers context transiotion - which would means measures used in row-context are then wrapped in CALCULATE automatically.

 

Could you please help me understand.

  • Hello Hoping,

    you are right, whenever you call a measure, like

     

    [MyMeasure],

     

    what is executed is

     

    CALCULATE ( 
          < MyMeasure DAX code >
    )

     

    so a hidden CALCULATE is there all the time and this is why the convention is to drop the table name from call to measures,

     

    [MyMeasure] and not Table[MyMeasure]

     

    so that measure calls can be immediately distinguished from columns call where CALCULATE is not involved and no context transition happens, Table[Column]

     

    If this helped, please consider giving kudos and mark as a solution

    @me in replies or I'll lose your thread

    Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

    Consider voting this Power BI idea

    Francesco Bergamaschi

    MBA, M.Eng, M.Econ, Professor of BI

5 Replies

  • Hello Hoping,

    you are right, whenever you call a measure, like

     

    [MyMeasure],

     

    what is executed is

     

    CALCULATE ( 
          < MyMeasure DAX code >
    )

     

    so a hidden CALCULATE is there all the time and this is why the convention is to drop the table name from call to measures,

     

    [MyMeasure] and not Table[MyMeasure]

     

    so that measure calls can be immediately distinguished from columns call where CALCULATE is not involved and no context transition happens, Table[Column]

     

    If this helped, please consider giving kudos and mark as a solution

    @me in replies or I'll lose your thread

    Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

    Consider voting this Power BI idea

    Francesco Bergamaschi

    MBA, M.Eng, M.Econ, Professor of BI

  • Conside the scenario where I am creating a calculated column and using a measure to create it.
    
    

    That is not a viable scenario. Measures need filter context to be meaningful. That's not something a calculated column can meaningfully be fed from.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Hoping,

     

    Thank you for reaching out to the Microsoft Fabric Forum Community, and special thanks to for prompt and helpful responses.

     

    Just following up to see if the Response provided by community members were helpful in addressing the issue.

    If one of the responses helped resolve your query, please consider marking it as the Accepted Solution. Feel free to reach out if you need any further clarification or assistance.

     

    Best regards,
    Prasanna Kumar

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Hoping,

     

    Just following up to see if the Response provided was helpful in resolving your issue. Please feel free to let us know if you need any further assistance.

     

    Best regards,

    Prasanna Kumar

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Hoping,

     

    Just following up to see if the Response provided by community members were helpful in addressing the issue.

    If one of the responses helped resolve your query, please consider marking it as the Accepted Solution. Feel free to reach out if you need any further clarification or assistance.

     

    Best regards,
    Prasanna Kumar