How to count same objects in list

Hello its my first question here, i would like to know how to count same object in a list.
I have to build a real-time update of stock from planning rentable bike.

I have a list of rentable bike between 2 dates like (to not consider product’s name):
LIST BETWEEN 2 dates:
[coco,coco,nageur,dada,coco,chapeau,chapeau]

i would return this :
-coco: 3
-dada: 1
-nageur: 1
-chapeau: 2

it been > 1 week i tried to solve that:
i filter list of product between 2 dates with .Unique(),
then i run on each different product with formulamap() and countif(), the sum on same product in list (but without .Unique() )
And i hope to find count of each product find in list.
But i find: 1 , 1

Location
  .Filter(
    sequence_periode.Contains(sequence_days)
  )
  .rowid_product
  .Listcombine()
  .Unique()
  .FormulaMap(
    CountIf(
      CurrentValue,
      CurrentValue
        .contains(
          Location
            .Filter(
              sequence_periode.Contains(sequence_days)
            )
            .rowid_product
            .Listcombine()
        )
    )
  )

may i’m not clear,…

Hey, after some re-re-read on community forum, i fund solution:
i use withname ton nested value and loop trick.

sequence(
  1,
  Location
    .Filter(
      sequence_periode.Contains(sequence_days)
    )
    .Produits
    .Listcombine()
    .Unique()
    .count()
)
  .formulamap(
    WithName(
      CurrentValue,
      seq,
      Location
        .Filter(
          sequence_periode.Contains(sequence_days)
        )
        .Produits
        .Listcombine()
        .countif(
          CurrentValue
            .Contains(
              Location
                .Filter(
                  sequence_periode.Contains(sequence_days)
                )
                .Produits
                .Listcombine()
                .nth(
                  seq
                )
            )
        )
    )
  )

:wave: Hey there!

Im unclear exactly what you are looking for, but from your initial post, you may be able to find a simpler solution to your problem

Here is an example doc with some example formulas - Hopefully that helps you out!

2 Likes

Thx you ton help, it help me that in pqrt what i would like, keep help eqch other, hqve nice day

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.