Forum Discussion
jvirgi
Helper III
6 years agoCalculating Measures by Searching text in another table
I'd like to create measures to calculate the counts of Sports within AllSports from Table 1 as well as then average rating and sentiment for each of the Sports in Table 2. For example for football -...
- Anonymous6 years ago
Hi jvirgi ,
You can create 2 measures for calculating average of rating and sentiment as below:
Avg rating = SUMX ( FILTER ( 'Table 1', SEARCH ( MAX ( 'Table 2'[Sports] ), 'Table 1'[AllSports], 1, 0 ) > 0 ), 'Table 1'[Rating] ) / COUNTROWS ( FILTER ( 'Table 1', SEARCH ( MAX ( 'Table 2'[Sports] ), 'Table 1'[AllSports], 1, 0 ) > 0 ) )Avg sentiment = SUMX ( FILTER ( 'Table 1', SEARCH ( MAX ( 'Table 2'[Sports] ), 'Table 1'[AllSports], 1, 0 ) > 0 ), 'Table 1'[Sentiment] ) / COUNTROWS ( FILTER ( 'Table 1', SEARCH ( MAX ( 'Table 2'[Sports] ), 'Table 1'[AllSports], 1, 0 ) > 0 ) )Best Regards
Rena
camargos88
Community Champion
6 years agoHi jvirgi ,
I've created this file as an example: Download PBIX
I used Power Query to split the sport in new rows.
Ricardo