cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Add Topic and keyword to main table based on second table

Hello!

Hopefully you can all help me, I have a main table with cells with large body of text, then I also have a second table with Topic and keywords fields. In the first table I want to create two new columns indicating the Topic and keyword from the second table. 

 

Here are examples:

Main:

IDDateText
12020-05-12Apples and Oranges are great
22020-05-13Random topic that is about vegetables
32020-05-14Bananas are the best
42020-05-14Oranges contain Vitamin C

 

Keywords:

TopicKeyword
Topic1Apples
Topic1Oranges
Topic1Bananas
Topic2Random

 

I want to change Main to:

IDDateTextTopicKeyword
12020-05-12Apples and Oranges are greatTopic1Apples
12020-05-12Apples and Oranges are greatTopic1Oranges
22020-05-13Random topic that is about vegetablesTopic2Random
32020-05-14Bananas are the bestTopic1Bananas
42020-05-14Oranges contain Vitamin CTopic1Oranges

Please note that "1" got duplicated, to also list the keyword Oranges separate. My goal with this is to have a slicer in the visualization that I can used to show all entries with just oranges.

 

Is this possible? I will also take suggestions if there a more elegant way to avoid duplication of the '1' entry 🙂 

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Add Topic and keyword to main table based on second table

Hi @MvdL 

 

Based on the blog post below you can do a simiçar approach with a measure:

 

https://powerpivotpro.com/2014/01/containsx-finding-if-a-value-in-table-1-has-a-matching-value-in-ta...

 

Add the following measure to your model:

Contains Selected Word = 
IF(
      SUMX(SUMMARIZE(Keywords;Keywords[Keywords]);
           FIND(
                UPPER(Keywords[Keywords]);
                UPPER(SELECTEDVALUE(Main[Text]))
                ;;0
               )
          ) > 0;
      "Contains Words Selected";
      Blank()
     )

 

Now you can filter out the visualization based on the slicer and the measure.

 

On the image below I have added the filter but only keep the the ones that the measure is not blank.

Search_words.gif

 

Check PBIX file attach.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog:

Power BI em Português





View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

Re: Add Topic and keyword to main table based on second table

Hi @MvdL 

 

Based on the blog post below you can do a simiçar approach with a measure:

 

https://powerpivotpro.com/2014/01/containsx-finding-if-a-value-in-table-1-has-a-matching-value-in-ta...

 

Add the following measure to your model:

Contains Selected Word = 
IF(
      SUMX(SUMMARIZE(Keywords;Keywords[Keywords]);
           FIND(
                UPPER(Keywords[Keywords]);
                UPPER(SELECTEDVALUE(Main[Text]))
                ;;0
               )
          ) > 0;
      "Contains Words Selected";
      Blank()
     )

 

Now you can filter out the visualization based on the slicer and the measure.

 

On the image below I have added the filter but only keep the the ones that the measure is not blank.

Search_words.gif

 

Check PBIX file attach.


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog:

Power BI em Português





View solution in original post

Highlighted
New Member

Re: Add Topic and keyword to main table based on second table

Thanks! This works 🙂 

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors