Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi everyone,
I would need your help on the following case. I have 2 tables:
I would like to know, for each country in table 1, the number of text elements in table 2 that contain at least one occurrence of that country.
In the example below, the desired output will be:
Thank you in advance for your help, much appreciated!
Solved! Go to Solution.
Hi @amineregask
You need to remove that "each" after "Custom", before (X)=>
= Table.AddColumn(#"Changed Type1", "Custom", (x)=> List.Count(List.Select(Table2[Text], each Text.Contains(_,x[Country]))))
@watkinnc the way seems better, but there is a typo, you can try like this
Table.AddColumn(#"Changed Type1", "Custom", each List.Count(List.FindText(Table2[Text],[Country])))
Actually it looks like my typo is that it should read in Counts, not in counts...
let
Country2 = Table2[Text],
NewTable = Table1,
Counts = Table.AddColumn(NewTable, "Total", each List.Count(List.FindText(Country2, [Text]))
in Counts
--Nate
let
Country2 = Table2[Text],
NewTable = Table1,
Counts = Table.AddColumn(NewTable, "Total", each List.Count(List.FindText(Country2, [Text]))
in counts
--Nate
Hi @amineregask
If your Table2 and Text column are different names, please change it accordingly
(x)=> List.Count(List.Select(Table2[Text], each Text.Contains(_,x[Country])))
Hi @Vera_33 thanks a lot for your quick reply!
When I create the custom column, I get "function" values in it. Did I miss any step?
Thank you!
Hi @amineregask
You need to remove that "each" after "Custom", before (X)=>
= Table.AddColumn(#"Changed Type1", "Custom", (x)=> List.Count(List.Select(Table2[Text], each Text.Contains(_,x[Country]))))
@watkinnc the way seems better, but there is a typo, you can try like this
Table.AddColumn(#"Changed Type1", "Custom", each List.Count(List.FindText(Table2[Text],[Country])))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
102 | |
53 | |
21 | |
12 | |
12 |