Forum Discussion

giroldoale's avatar
giroldoale
Helper I
5 years ago
Solved

when to use Calculate

Hi, if I do not need to put a filter into Calculate, what would be the difference between these two expressions?  - CALCULATE(COUNT('OTD Details'[Somma di OC Number])) - COUNT('OTD Details'[Somma ...
  • Jihwan_Kim's avatar
    5 years ago

    Hi, giroldoale 

    COUNT('OTD Details'[Somma di OC Number]): in a general situation, you can use this as a measure to put into the visual when the visualization already has the filter context. if it does not have the filter context, for instance, if you put this into the card visualization, the count from the first row until the last row will be measured.

     

    -- CALCULATE(COUNT('OTD Details'[Somma di OC Number])): In a general situation, you can use this when creating a calculated column. When creating a calculated column, and if you do not use calculate function, it will count from the first row until the last row, because it did not define the filter context. However, if you use it with calculate, it defines the filter context and it will show the result of row by row.

     

    I hope I explained well.

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: https://www.linkedin.com/in/jihwankim1975/