Count based on multilple values

Hello,

I need to add a field on the contact page that would calculate the number of open cases of a specific type. 

I tried the following formula, but even tho i'm not getting error message, the calculation does not seem to work.


count(and(equal(related($cases,"type"),"reclamation"),not(equal(related($cases,"status"),"closed"))))


Any idea how to acheave my goal?

Thanks for your help.

Parents
  • Hi  ,

    To achieve this use case, I recommend doing the following:

    1. Create a calculated field (e.g. case_evaluation_c) in the Cases module to evaluate the criteria you want to count records on. Based on your example, the formula could look like the following:
      Fullscreen
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      ifElse(
      and(
      equal(
      $type,
      "reclamation"
      ),
      not(
      equal(
      $status,
      "closed"
      )
      )
      ),
      "Open - Reclamation",
      ""
      )
      XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    2. Then, in the custom field on your Contacts module, you would use the countConditional formula to count cases based on the value in your custom field from step 1. The formula would look like the following:
      Fullscreen
      1
      2
      3
      4
      5
      countConditional(
      $cases,
      "case_evaluation_c",
      "Open - Reclamation"
      )
      XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    The reason the first field is necessary is that the countConditional formula can only accept a single condition. The first field allows you to evaluate as many conditions as you need within that module to then give you reliable datapoints for conditional rollup and count calculations in parent modules.

    Chris

  • Nice one  Thumbsup

    .

    CRM Business Consultant

Reply Children
No Data