Forum Discussion

AlB's avatar
AlB
Icon for Community Champion rankCommunity Champion
7 years ago
Solved

DAX: Puzzling ALL behaviour in context transition

Hi there,

 

I have the following calculated columns in the 'Product' table of the Contoso data model (available here). 'Product'[ProductKey] has 2517 unique values.

 

A) ‘Product’[Test 1]=CALCULATE(ALL(’Product’[ProductKey])) yields the ProductKey per row.

B) ‘Product’[Test 2]=CALCULATE(COUNTROWS(ALL(’Product’[ProductKey]))) however yields 2517 in all rows (size of the 'Product' table)

 

I find it puzzling that the filter resulting from context transition does affect the result in ‘Product’[Test 1] but it doesn't in ‘Product’[Test 2]. Could someone explain what is going on?

 

Thanks very much

  • Hi AlB and MattAllington

     

    I did email Jeffrey Wang about this issue recently and he confirmed it is a bug and that it will be fixed in a future release.  I don't have a timeframe, unfortunately.  

11 Replies

  • v-danhe-msft's avatar
    v-danhe-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi AlB,

    The sample file you have offered could not be opened due to the license problems coudl you please just share some sample file to have a test?

    And the formula you have offered in ‘Product’[Test 1]=CALCULATE(ALL(’Product’[ProductKey])) seemed wrong, if you want to use the CALCULATE function, you should have an Aggregate function in it, could you please modify your formula and test it again?

     

    Regards,

    Daniel He

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

      Hi v-danhe-msft

      Here's another file.

      There is no error. Both 'Test 1' and 'Test 2' work as you can see in the attached file. I am just trying to understand why the interaction between context transition and ALL() seems to be different in 'Test 1' than in 'Test 2'

      Thanks