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.
Hi,
This is my first post in here, hope you guys can help me with my request.
I have a table with customers feedback and I need to classify those feedback in categories (Advisor's Behavior, Products, Stores ...). Those categories contain key words. I formatted the categories as differents lists, therefore I have a list for each category and a table with feedbacks.
What I'm trying to do is that whenever there's one of the keywords on the list that get flagged on the table, it returns the value 1, if not 0. I don't need to know which key word is mentionned exactly, I just need to know if that category is mentionned or not.
I have it up and running on Excel with logic functions, but I need to do it in PowerBI with M Functions. I tried the "Contain" function with a custom column but I can't reference an external list on it.
I'm trying to get something like this : IF text_column, CONTAINS one of the words in the CATEGORY LISTS, then 1 if not 0
Let me know if you guys might need more details or perhaps the pbix file.
Thank you,
Anas
Solved! Go to Solution.
You may use SEARCH Function to add a calculated column in DAX.
Column = SIGN ( SUMX ( Table2, SIGN ( SEARCH ( Table2[category], Table1[feedback],, 0 ) ) ) )
You may use SEARCH Function to add a calculated column in DAX.
Column = SIGN ( SUMX ( Table2, SIGN ( SEARCH ( Table2[category], Table1[feedback],, 0 ) ) ) )
@v-chuncz-msftthank you so much for your reply!
It did work perfectly as a a new column on DAX but I can't have it inserted as a custom column on the query editor?
I will need to do some transformation later-on on the Data gathered from that measure on the query editor.
You may combine the two queries in The Advanced Editor or invoke a custom function.
https://msdn.microsoft.com/en-us/library/mt185361.aspx
@v-chuncz-msft thank you for your reply.
Forgive my ignorance, but I just can't figure out how to get from creating this DAX function to a Custom Function on the Advanced Editor ..
Unfriendliness = SIGN (
SUMX(Unfriendliness; SIGN(SEARCH(Unfriendliness[Unfriendliness];Verbatims[Comment];;0)))
What I'm trying to do is to get a table with all verbatim cateogries labeled as 1 or 0 and then I'm going to unpivot all the categories. In steps it should be something like that :
1st Step : Invoke Custom Function to search for key words on the text and display 1 if True, 0 if False
Verbatim | Kindness | Response Time | Clarity |
It takes too much time to get someone on the phone | 0 | 1 | 0 |
You customer service is great, very nice person on the phone | 1 | 0 | 0 |
All the information given was very clear, thank you | 0 | 0 | 1 |
Final Result : Transform Data - Unpivot Categories Attributes
Verbatim | Category |
It takes too much time to get someone on the phone | Response Time |
You customer service is great, very nice person on the phone | Kindness |
All the information given was very clear, thank you | Clarity |
My apologize for the long reply, thank you in advance for your help and patience 😄
Hi @AnasBach,
Once you have unpivoted the dataset, push it to the Data Model (by clicking on Close and Apply). Then write the calculated column formula suggested above.
My apologies @Ashish_Mathur for my tardy reply.
The calculated formula comes before the unpivot actually, yet It still doesn't get what need exactly .. The custom measure is only available on DAX. I need it as a Custom Function that can be invoked on other entries on the Query Editor. Then, I can unpivot the attributes and get a nicely classified table.
Thank you
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 |
---|---|
110 | |
94 | |
81 | |
66 | |
58 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |