Count in a whole column separated by commas

good day
I have a *Product* table, and another *scan* table
In the scan table I have 5 fields to scan products, and another field that concatenates the 5 scanned products separated by "," .
I want to create a virtual column in the *Products* table, which tells me the number of times this product was scanned.
something gives me the idea of โ€‹โ€‹having a count and split , but I couldn't, any ideas?
Thanks.

0 4 88
4 REPLIES 4

 

 

COUNT(
 FILTER(
  "scan", 
  CONTAINS(
   [_THISROW].[product],
   [concatenated vc]
  )
 )
)

 

should work assuming no duplicated products in the same row

hanks for replying, but it doesn't work, only when it's a product without commas, it's counting it.
and it would be excellent to find an alternative in case the value is repeated in the concatenated column.
Thank you again

Could you show us how it is failing?

Also additional questions.

How is your concatenated column defined? CONCATENATE([scan1],",",[scan2],,,[scan5])?

Would it work if you use a separator that is not used in your products?

You using product names and not code such as UNIQUID() or your own product code? Would it work if you use code instead of names?

Steve
Platinum 4
Platinum 4
COUNT(
  FILTER("scan", ([_THISROW].[product-id] = [scan-product-1]))
  + FILTER("scan", ([_THISROW].[product-id] = [scan-product-2]))
  + FILTER("scan", ([_THISROW].[product-id] = [scan-product-3]))
  + FILTER("scan", ([_THISROW].[product-id] = [scan-product-4]))
  + FILTER("scan", ([_THISROW].[product-id] = [scan-product-5]))
)

Replace product-id with the name of the column in the Product table that contains the value that would match a scanned value; and scan-product-1 (-2, ...) with the name of the scan table column that receives the scanned value.

Top Labels in this Space