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

Count how many times terms appear in another column with filters

Hey all, hoping someone can help with this. I'm trying to count how many times each term in Table1 appears in Table2 phrase column for all the phrases selected and where the category is "A". On my page, there is a slicer with Table3 ItemID, where one ItemID can be selected at a time. Table2 and Table3 are joined together by ItemID. So if ItemID 1 is selected here, it would count the number of times each term appears in Phrase 1 and Phrase 2 and return the count against each term. 

 

Table1

Term
X
X
X

 

Table2

ItemIDPhraseCategory
11A
12A
13B

 

Table3

ItemID
1
2
3

 

This is what I've got so far, but I can't seem to get filters to work to add the context of all selected and category A.

 

Measure =
VAR CurrWord =
SELECTEDVALUE ( 'Table'[term] )
RETURN
COUNTROWS (
FILTER ( Table2
, SEARCH ( CurrWord, [phrase], 1, -1 ) > 0 ) )
 
Any help would be greatly appreciated! 🙂 
1 ACCEPTED SOLUTION

Hi @badger123

 

You may drag the category column to the visual level filter like below.Then the count of your measure would be changeg by the filter.

1.png

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

So Table 1 Term would be something like:

 

Red

Blue

Fish

 

And Table2 Phrase might be something like:

 

Red Fish Blue Fish

One Fish Two Fish

 

And you would want an output of

 

Red - 1

Blue - 1

Fish - 4

 

Is that correct?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler yes, exactly. But also only counting terms in the phrases in Table 2 for the selected Item ID and where Category = "A". 

 

Hi @badger123

 

You may drag the category column to the visual level filter like below.Then the count of your measure would be changeg by the filter.

1.png

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.