I have a content type "Lunch" containing a paragraph type field named "Ingredients". This is a multiple values field which store a prapgraph type named "Ingedients" => Taxonomy term + Quantity
|- Ingredient1 (Term1 reference + quantity1)
|- Ingredient2 (Term2 reference + quantity2)
I have created a view displaying the tiles of my 3 encoded lunches. Until here, everything is fine.
Now, I would like to add an exposed filter to get all lunches congtaining a specific ingredient. For this I have added a relationship on the ingredient field:
Paragraph referenced from field_ingredients
Doing this is fine, because now, I can add an exposed filter using this relationship
Doing this is bad, because as soon as I have added this relationship the number of rows in my view has been multiplcated by the number of ingredients... even if I check distinct in the SQL parameters
Any hint to solve this issue?
EDIT TO ADD: I could solve this by removing the duplicates in
hook_views_pre_render but is it really the best thing to do?
REAL SOLUTION BASED ON prkos ANSWER:
1-In the advance>Other section I have enabled the aggregation
2-I have added my Ingredient field in the field section (exclude from display)
=>This is the taxonomy reference field of my Paragraphs field named "Ingedients". In other words, I have a paragraph type with 2 fields (Ingredient and quantity) and I selected "Ingredient". Do not select the paragraph itself.
3-In the aggregation parameter of this added field, I selected
ID of the entity