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.
I have a Keywords table:
Keyword |
KeywordOne |
KeywordTwo |
KeywordThree |
and a Messages table:
Id | Message |
1 | This message contains KeywordOne |
2 | This contains KeywordOne and KeywordTwo |
3 | KeywordTwo and KeywordThree are in this message |
4 | No keywords here |
I know how to search messages for keywords and expose this though a column, such as:
ContainsKeyword = IF( SUMX(Keywords, FIND( UPPER(Keywords[Keyword]), UPPER(Messages[Message]) ,,0 ) ) > 0, TRUE, FALSE )
but what I'm looking to create a new table like so:
MessageId | Keyword |
1 | KeywordOne |
2 | KeywordOne |
2 | KeywordTwo |
3 | KeywordTwo |
3 | KeywordThree |
Some things to note:
If it's possible to do this with a measure on either table, that would be even better. Any help would be most appreciated.
Thanks
Solved! Go to Solution.
You would really have to create a new table (rather than adding a measure to either table) because your new table expresses a many-to-many relationship between Messages and Keywords.
You can create such a table using DAX, using GENERATE to join the tables:
MessageKeyword = VAR JoinedTables = GENERATE ( Messages, FILTER ( Keywords, FIND ( UPPER ( Keywords[Keyword] ), UPPER ( Messages[Message] ),, 0 ) > 0 ) ) RETURN SELECTCOLUMNS ( JoinedTables, "MessageId", Messages[Id], "Keyword", Keywords[Keyword] )
I'm sure you could also do this with Power Query.
Regards,
Owen
You would really have to create a new table (rather than adding a measure to either table) because your new table expresses a many-to-many relationship between Messages and Keywords.
You can create such a table using DAX, using GENERATE to join the tables:
MessageKeyword = VAR JoinedTables = GENERATE ( Messages, FILTER ( Keywords, FIND ( UPPER ( Keywords[Keyword] ), UPPER ( Messages[Message] ),, 0 ) > 0 ) ) RETURN SELECTCOLUMNS ( JoinedTables, "MessageId", Messages[Id], "Keyword", Keywords[Keyword] )
I'm sure you could also do this with Power Query.
Regards,
Owen
Super, thanks Owen!
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 |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |