Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Filter context in dax with relationship clarify

Hello everyone,   first of all, I study Definitive guide to dax vol2, reading blogs of sqlbi.com etc..so please do not respond that I should watch it I still fighting witch filter context, I have...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

     

    Regarding your formula `User per City = CALCULATE(COUNT(User[ID_user]),Location[ID_location])`**:

    The reason this formula does not produce the expected result is due to how the `CALCULATE` function works in conjunction with the `COUNT` function. The `CALCULATE` function changes the context in which the data is evaluated, and it expects a filter expression as its second argument. However, `Location[ID_location]` as used here does not serve as a filter expression but rather as a column reference, which is why it doesn't work as expected.

     

    For more details, please refer: CALCULATE – DAX Guide

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly.