Forum Discussion
URGENT HELP needed: search for multiple values from different lists
I have two lists of keywords: Brand and Manufacturer. I have filters allowing to select multiple out of both lists.
I need to find the (selected) keywords from (both) these lists in a table column Text and sum up the amounts Value corresponding to each found line that contains at least on of the selected keywords.
I am currently using a measure:
8 Replies
- lbendlin
Super User
We won't be able to help without sample data.
- AnonymousNot applicable
Here some mock data:
Text Date Value Apples' China risk 9/8/2023 778,985 Pick Peanuts, Pick Apples and Get Out of Town 10/1/2023 13,270,269 A Low-Cost Grocery Delivery Service With Much More Than Ugly Apples 11/9/2023 5,543,076 Krispy Kreme urgently recalls four-pack of doughnuts over peanut allergy fears 8/7/2023 4,013,349 Recall over allergy fears: Chocolate raisin snacks may contain peanuts 6/9/2023 6,518,508 I have a severe allergy to strawberries 9/23/2023 4,013,349 Aldi urgently recalls deli meats over allergy fears 8/23/2023 4,013,349 The two keyword lists are:
Cause Effect apple allergy peanut recall raisin You can consider then the following measure syntax:
Measure =VAR _tbl1 = CALCULATETABLE(VALUES(kw[Cause]), FILTER(kw,CONTAINSSTRINGEXACT(MAX(Table[Text]),kw[Cause])=TRUE()))VAR _tbl2 = CALCULATETABLE(VALUES(kw[Effect]), FILTER(kw,CONTAINSSTRINGEXACT(MAX(Table[Text]),kw[Effect])=TRUE()))VAR _tbl = UNION(_tbl1, _tbl2)VAR _x = SUMX(_tbl, MAX(Table[Value])) / COUNTROWS(_tbl)RETURN _xCause and Effect appear as filters on the page, multiple selection allowed.I want to find the (selected) keywords from both these lists in Text and sum up the amounts Value corresponding to each found line that contains at least on of the selected keywords.In a table or chart with Date, Text, Value, Measure I get wrong totals an no Totals (sums in the table). Of course the chart won't aggregate over Date.I hope this helps. Many thanks!- lbendlin
Super User
- AnonymousNot applicable
Many thanks!
But I want it to show me texts with all selected keywords, no matter which lists, with multiple selection allowed.
E.g. in image it should only show the last text, "Recall over allergy fears..."
And it also doesn't show any totals, the same problem I had and which makes any aggregeation (e.g. over date) impossible.