This post is a follow up on my previous post of Sentiment Analysis in Power BI Desktop. In Power BI Nov updates, some AI transformation capabilities have been added to Power Query including sentiment analysis which is part of Text Analytics. You will see the AI Transforms in Power Query Home ribbon.
If you don’t see it, you need to enable it by going to File, Options and settings, Options and then tick the box for AI insights function browser. The Learn more hyperlink has not been updated to take you to relevant page as of this writing. It will take you to Microsoft main page instead, I hope this will be rectified soon.
To use these new AI features, you need to have access to a premium capacity backed workspace. If you don’t and clicked Text Analytics for example, you will see below error message.
If you do, this is what you will see. Select Score sentiment in the left navigation pane for Text Analytics and in the Text drop-down select the text column (Comment field is the one in my sample data) you want to do sentiment analysis and click OK.
A Score sentiment column has been added to give you the score for each text value in Comment column. Also notice that behind the scene, a Score sentiment function has been added.
If you look at the M code generated for the Table query, a M function named AIFunctions.PostProcess has been called to give you the output of Score sentiment column.
As of this writing, Power Query M function reference has not been updated yet so I can’t find any reference there.
However if you paste below M code in a blank M query, you will see all AI functions reference in Power Query and if you click the blank space in column Value for the first row, you will see the definition for AIFunctions.PostProces.
Source = #shared,
#”Converted to Table” = Record.ToTable(Source),
#”Filtered Rows” = Table.SelectRows(#”Converted to Table”, each ([Name] = “AIFunctions.Capacities” or [Name] = “AIFunctions.Contents” or [Name] = “AIFunctions.ExecuteInternal” or [Name] = “AIFunctions.GetAutoMLEntity” or [Name] = “AIFunctions.PostProcess”))
If you have read my previous post, you will see that performing Text Analytics in the latest Power BI desktop is a lot easier if you have access to a premium workspace. When you publish your PBIX file, you will need to publish it to a premium workspace as well so it will continue to work in Power BI service.