0

Count each different field value

I have a table with a Label field. This label field is a selection and can be ''A'' , ''B'' or ''C'' for exemple. There is another field named ''Active''. 

So I can assign a contact to a group (A,B or C) and tell if it is active. So for exemple here a table list:

contact         group           active

1                  A                  yes

1                 B                   no

2                A                   yes

3               C                   yes

I wish to make a view with all the field value and their count...

group          count

A                 2

B                0

C                1

 

For now, I have

group     count

A         2

A        2

C       1

and if I group filter, the count column disapeared...

 

here is my formula for view:

let t := this;
(select 'Contact Groupe Inscrits')[actuel = true and Inscrit = true]

 

count field:

let t := this;
first(cnt((select 'Contact Groupe Inscrits')[actuel = true and Inscrit = true and text(Label) = text(t.Label)]))

Maybe there is a way to do it in the view formula...I wish to remove double value. I tried with array but not working...

thanks!

1 reply

null
    • Jorg
    • 4 yrs ago
    • Reported - view

    Hi, 

    Possibly it will work like that.

    1. The group column:

     

    let mygroup := group;
    let firstID := first((select 'Contact Groupe Inscrits')[group = mygroup].Id);
    if Id = firstID then "Yes" end

    Then filter for "Yes"

     

    2. The count column: 

     

    let mygroup := group;

    cnt((select 'Contact Groupe Inscrits')[actuel = true and Inscrit = true and mygroup = group])

    Best, Jörg

Content aside

  • 4 yrs agoLast active
  • 1Replies
  • 1602Views