Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

CALCULATETABLE filter is removed

can someone explain to me why the code below, return a list of all the rows in the SaleTerritoty table?

 

EVALUATE 
CALCULATETABLE (
    CALCULATETABLE ( 
        'Sales Territory',
        ALL ( 'Sales Territory'[Country] ) 
    ),
    'Sales Territory'[Country] = "United States" 
)
  • Hi Anonymous

     

    You will find this article very useful

    https://www.sqlbi.com/articles/order-of-evaluation-in-calculate-parameters/


    "the order of execution of CALCULATE and CALCULATETABLE parameters is different from other DAX functions

    The order of evaluation of the parameters of a function is usually the same as the order of the parameter: the first parameter is evaluated, then the second, then the third, and so on. This is always the case for most of the DAX functions, but not for CALCULATE and CALCULATETABLE. In these functions, the first parameter is evaluated only after all the others have been evaluated"

2 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous

     

    You will find this article very useful

    https://www.sqlbi.com/articles/order-of-evaluation-in-calculate-parameters/


    "the order of execution of CALCULATE and CALCULATETABLE parameters is different from other DAX functions

    The order of evaluation of the parameters of a function is usually the same as the order of the parameter: the first parameter is evaluated, then the second, then the third, and so on. This is always the case for most of the DAX functions, but not for CALCULATE and CALCULATETABLE. In these functions, the first parameter is evaluated only after all the others have been evaluated"

    • Anonymous's avatar
      Anonymous
      Not applicable

      Zubair_Muhammad

      I am wondering why I didn't see this article before !!!!!
      Thank you so much Zubair