Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
badger123
Resolver I
Resolver I

Search in text and sum values measure

Hi all, looking for help with a measure please... 

 

I have measure (see below) which is searching for a given term in phrases in another table. I am displaying the output in a table visual with term as column 1 and count of term as column 2. I'd like to create a measure that sums up the phrase volumes. I've included tables and desired output below. 

 

Measure1 = 
VAR CurrWord =
SELECTEDVALUE ( 'Table1'[term] )
RETURN
COUNTROWS (
    CALCULATETABLE (
        VALUES ( Table2[phrase]),
        FILTER ( Table2
        , SEARCH ( CurrWord, Table2[phrase], 1, -1 ) > 0 ) ))

Table1

Term
apples
oranges
bananas

 

Table2

PhrasePhrase Volume
I like apples and oranges100
I do not like bananas200
I love apples the most300

 

DESIRED OUTPUT TABLE VISUAL:

TermMeasure 1Measure 2?
apples2400
oranges1100
bananas1200
1 ACCEPTED SOLUTION
LivioLanzo
Solution Sage
Solution Sage

@badger123 

 

you are nearly there, instead of doing

 

COUNTROWS (
    CALCULATETABLE (
        VALUES ( Table2[phrase]),
        FILTER ( Table2
        , SEARCH ( CurrWord, Table2[phrase], 1, -1 ) > 0 ) ))

you can do

 

calculate(sum( Table2[phrase volume]),
        FILTER ( Table2
        , SEARCH ( CurrWord, Table2[phrase], 1, -1 ) > 0 ) ))

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

View solution in original post

2 REPLIES 2
LivioLanzo
Solution Sage
Solution Sage

@badger123 

 

you are nearly there, instead of doing

 

COUNTROWS (
    CALCULATETABLE (
        VALUES ( Table2[phrase]),
        FILTER ( Table2
        , SEARCH ( CurrWord, Table2[phrase], 1, -1 ) > 0 ) ))

you can do

 

calculate(sum( Table2[phrase volume]),
        FILTER ( Table2
        , SEARCH ( CurrWord, Table2[phrase], 1, -1 ) > 0 ) ))

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Thanks for your help! It seems so easy when you know the answer 😛 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.