Discover millions of ebooks, audiobooks, and so much more with a free trial

From $11.99/month after trial. Cancel anytime.

Self-Service AI with Power BI Desktop: Machine Learning Insights for Business
Self-Service AI with Power BI Desktop: Machine Learning Insights for Business
Self-Service AI with Power BI Desktop: Machine Learning Insights for Business
Ebook431 pages3 hours

Self-Service AI with Power BI Desktop: Machine Learning Insights for Business

Rating: 0 out of 5 stars

()

Read preview

About this ebook

This book explains how you can enrich the data you have loaded into Power BI Desktop by accessing a suite of Artificial Intelligence (AI) features. These AI features are built into Power BI Desktop and help you to gain new insights from existing data. Some of the features are automated and are available to you at the click of a button or through writing Data Analysis Expressions (DAX). Other features are available through writing code in either the R, Python, or M languages. This book opens up the entire suite of AI features to you with clear examples showing when they are best applied and how to invoke them on your own datasets.
No matter if you are a business user, analyst, or data scientist – Power BI has AI capabilities tailored to you. This book helps you learn what types of insights Power BI is capable of delivering automatically. You will learn how to integrate and leverage the use of the R and Python languages for statistics, how to integrate with Cognitive Services andAzure Machine Learning Services when loading data, how to explore your data by asking questions in plain English ... and more! There are AI features for discovering your data, characterizing unexplored datasets, and building what-if scenarios.
There’s much to like and learn from this book whether you are a newcomer to Power BI or a seasoned user. Power BI Desktop is a freely available tool for visualization and analysis. This book helps you to get the most from that tool by exploiting some of its latest and most advanced features.
What You Will Learn
  • Ask questions in natural language and get answers from your data
  • Let Power BI explain why a certain data point differs from the rest
  • Have Power BI show key influencers over categories of data
  • Access artificial intelligence features available in the Azure cloud
  • Walk the same drill down path in different parts of your hierarchy
  • Load visualizations to add smartness to your reports
  • Simulate changes in data and immediately see the consequences
  • Know your data, even before you build your first report
  • Create new columns by giving examples of the data that you need
  • Transform and visualize your data with the help of R and Python scripts

Who This Book Is For
For the enthusiastic Power BI user who wants to apply state-of-the-art artificial intelligence (AI) features to gain new insights from existing data. For end-users and IT professionals who are not shy of jumping into a new world of machine learning and are ready to make that step and take a deeper look into their data. For those wanting to step up their game from doing simple reporting and visualizations by making the move into diagnostic and predictive analysis.
LanguageEnglish
PublisherApress
Release dateSep 12, 2020
ISBN9781484262313
Self-Service AI with Power BI Desktop: Machine Learning Insights for Business

Related to Self-Service AI with Power BI Desktop

Related ebooks

Programming For You

View More

Related articles

Reviews for Self-Service AI with Power BI Desktop

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Self-Service AI with Power BI Desktop - Markus Ehrenmueller-Jensen

    © Markus Ehrenmueller-Jensen 2020

    M. Ehrenmueller-JensenSelf-Service AI with Power BI Desktophttps://doi.org/10.1007/978-1-4842-6231-3_1

    1. Asking Questions in Natural Language

    Markus Ehrenmueller-Jensen¹ 

    (1)

    CEO, Savory Data, Alkoven, Austria

    Communicating with computer systems in one’s everyday language is a long-held dream of many people. That’s why computer languages like COBOL or SQL were born (back in the twentieth century), which are clearly derived from English. But I don’t know of many end users who are fluent in either COBOL or SQL. Power BI’s Question & Answer (Q&A) functionality comes with a better approach. Imported data is automatically enriched by metadata (information about your data), and you can modify this information. This is much more than a convenient way of creating visualizations in a fast way, as you will see in this chapter.

    Q&A Visual

    First, I will show you how to create a Q&A visual, and then I will walk you through some examples of how to use the visual and improve its behavior.

    How to Create a Q&A Visual

    We have basically three ways to create a Q&A visual, as follows:

    Choose Insert – Q&A from the ribbon.

    Click on an empty space in your report canvas (to be sure to de-select any object on the report page) and then select Q&A from Visualizations. The icon looks like a speech bubble with a light bulb in its right lower corner.

    Simply double-click any empty space in your report page. That’s the fastest way to start the Q&A visual.

    Which of the three ways you use is totally your choice. All three give you the same functionality. I definitely prefer the third option (double-click), as this quickly gives me the search box and I can start typing what I am looking for.

    Q&A Visual Applied

    Figure 1-1 shows what working with a Q&A visual looks and feels like. You have an input field at hand (Ask a question about your data) in which you start typing your question (in order to receive an answer from your data). The visual automatically comes up with suggested questions (listed as buttons below the heading Try one of these to get started). When you click on one of those buttons, the text is copied into the input field and the answer is generated. Every time you clear the input field, the suggestions will be shown again.

    ../images/495490_1_En_1_Chapter/495490_1_En_1_Fig1_HTML.jpg

    Figure 1-1

    First impression of Q&A visual

    Please open the file ch01_Q&A.pbix in Power BI Desktop. Let’s try an example on our own. Ask for sales amount and the Q&A visual will show you 80.45M in a card visual as an answer (Figure 1-2).

    ../images/495490_1_En_1_Chapter/495490_1_En_1_Fig2_HTML.jpg

    Figure 1-2

    Answer to question sales amount is 80.45M

    You can narrow your question down by adding by category to the existing sales amount in the input field. When you enter your question, Q&A might assist you with suggestions of what kind of category you are looking for, for example. Product category is recognized as categorical data, and Q&A comes up with a bar chart in its answer, as you can see in Figure 1-3.

    ../images/495490_1_En_1_Chapter/495490_1_En_1_Fig3_HTML.jpg

    Figure 1-3

    Answer to question sales amount by category

    Q&A allows for filtering too. If you add for 2013 (Figure 1-4), Q&A recognizes that you are not asking for a column but rather want to filter on the content of a column, and it will filter the answer for the year 2013 only. In the current view you can only recognize that the filter was applied when watching the numbers on the x-axis (the numbers are now less than half of those in Figure 1-3—even when the relations of the numbers between the categories have hardly changed).

    ../images/495490_1_En_1_Chapter/495490_1_En_1_Fig4_HTML.jpg

    Figure 1-4

    Answer to question sales amount by category for 2013

    As soon as we convert the Q&A visual to a normal visual (by clicking on the first icon to the right of the input field, which looks like two frames connected by an arrow), you will see that a filter Year is in 2013 was added to the Filters on the right (Figure 1-5). If you don’t see the filter pane you can expand it by clicking on the < icon. You can then start changing the visual to your liking, as you now have access to all properties. Unfortunately, converting a Q&A visual to a normal visual is one-way. There is no way of converting this visual back to a Q&A visual to change your question. You would have to start over again by creating a new Q&A visual and enter the modified question.

    ../images/495490_1_En_1_Chapter/495490_1_En_1_Fig5_HTML.jpg

    Figure 1-5

    Answer to question is now converted to a normal visual, with filters applied

    Now we will create another Q&A visual and ask for sales amount by sales territory group. You can see in Figure 1-6 that the answer is a map visual, as sales territory group is recognized as geographical information. The map will only be shown if you are currently connected to the internet, as Microsoft’s Bing services is used to plot the data on the world map.

    ../images/495490_1_En_1_Chapter/495490_1_En_1_Fig6_HTML.jpg

    Figure 1-6

    Answer to question sales amount by sales territory group

    I don’t believe a map is very useful in this case, though. It uses plenty of space on the report page, with little information. And I can expect that my report users know where our sales territories lie on the world map. Let’s grip that opportunity and make use of another feature of Q&A: ask to plot the data as bar. You can see the result in Figure 1-7.

    ../images/495490_1_En_1_Chapter/495490_1_En_1_Fig7_HTML.jpg

    Figure 1-7

    Answer to question sales amount by sales territory group as bar

    Most of the standard visuals are supported by Q&A. The documentation says all of them are supported, but I failed in asking for a KPI visual or a slicer. Custom visuals are completely unsupported. That means you can’t ask Q&A to show them. But after you have converted the Q&A visual to one of the standard visuals you can of course convert the visual to any visual available.

    Watch out, as only terms with a single blue line underneath are understood and considered by Q&A for answering your question (like in the preceding samples). When Q&A does not understand what you are asking for, it puts two red lines underneath the word(s). Terms without any underline are simply ignored (see Figure 1-8).

    For example, if you ask for revenue in the sample file, Q&A will not understand the question, as there is no table, column, or measure with such a name available. See the later sections on Synonyms and Training Q&A for possibilities for teaching Q&A to answer questions about revenue, for instance, with existing sales amount measures.

    ../images/495490_1_En_1_Chapter/495490_1_En_1_Fig8_HTML.jpg

    Figure 1-8

    Q&A did not understand what we meant by revenue

    Note

    I remember that when someone demoed Q&A for me the first time, I silently said to myself: This is cool for demos—but who will use this feature in real-world scenarios? It was not very long before I discovered that—if I am familiar with the data model—I am way faster at creating visuals by just double-clicking the report canvas and typing in the measures and columns I need, than I am by finding them by scrolling up and down the field list on the right.

    Q&A Button

    There is an additional method for opening Q&A: Insert a button onto your report, which the user can then click to activate the Q&A dialog (not a Q&A visual; for differences, see Q&A dialog). You find all available buttons under Insert ➤ Buttons (Figure 1-9). And there you can choose Q&A. By default, the button shows a speech bubble icon and no further text (Figure 1-9).

    ../images/495490_1_En_1_Chapter/495490_1_En_1_Fig9_HTML.jpg

    Figure 1-9

    Choose Insert Buttons to insert a Q&A button

    Under Visualizations you have plenty of opportunities to change both the look and feel of the button and its action (Figure 1-10):

    Button Text

    Icon

    Outline

    Fill

    Title

    Background

    Lock aspect ratio

    General

    Border

    Action

    Visual header

    ../images/495490_1_En_1_Chapter/495490_1_En_1_Fig10_HTML.jpg

    Figure 1-10

    Visualizations options for a button

    All the attributes might change when in different states, such as when the button is just visible to the user (Default state) or when the user moves the mouse cursor over the button (On hover) or when the user actually presses the button (On press).

    Any space around your entered button text is automatically trimmed. By increasing padding the text moves from the right border toward the center of the frame. You can change the font color, size, and family, and the horizontal and vertical alignment.

    For the font color (indeed, for any color Power BI Desktop lets you set) you can choose from:

    Black

    White

    Up to eight theme colors (for more info on themes please refer to https://docs.microsoft.com/en-us/power-bi/desktop-report-themes)

    Three lighter (60%, 40%, 20%) and two darker (25%, 50%) versions of the preceding colors. Unfortunately, you can’t change those percentages.

    Recently chosen colors

    Custom color, which you can select from a color picker or by entering the hex code of the color

    Tip

    My recommendation is to stick to the first three (black, white, and the main theme colors) as you can change the latter at once by selecting a different theme for your Power BI Desktop file (instead of changing the color format options for every single object in your reports). Be careful with the lighter and darker versions—they might not fit with your CI (corporate identity).

    You can change the button’s icon to different pre-defined ones (which is not really recommended as it might confuse your users) or remove the button’s icon (by setting the icon to Blank).

    Title adds text above your button and offers the same properties as the button text itself, plus you can turn word wrapping on and off (when turned off, too-long texts will be cut off).

    The Outline definition lets you put a frame around the button. You set the transparency and weight of the frame, and can make the edges round. Border puts the frame not only around the button, but the title as well.

    Fill lets you change the background color and the transparency of the button itself, while Background extends the colored area to the title as well.

    Turning Lock aspect on or off changes the behavior if you resize the object when you use the handles on the corners of the object (Figure 1-11). It does not change anything for when you use the handles on top, bottom, or the sides of the object. Turning this property on means that the corner handles will resize simultaneously the height and the width of the object. After resizing, the proportion of height to width will stay the same. Turning this property off means that the corner handles will be able to resize the height and width of the object independently. After resizing, the proportion of height to width might have changed.

    ../images/495490_1_En_1_Chapter/495490_1_En_1_Fig11_HTML.jpg

    Figure 1-11

    Handles in the four corners act differently depending on option Lock aspect

    General lets you put in exact numbers for the x position and y position of the object and the width and height. Enter a description in Alt Text to enable a screen reader to read it when the object is selected.

    Action describes what should happen when the user clicks on this button. As we created this button as a Q&A button, the default behavior is to open the Q&A dialog. You can add a tooltip, which is shown as soon as you hover with the mouse cursor over the button.

    Visual header shows options that only have an effect after you have published the report to either Power BI Service or Power BI Report Server. Please find more information here: https://powerbi.microsoft.com/en-us/blog/power-bi-desktop-july-2018-feature-summary/#visualHeader

    Attention

    Please remember that within Power BI Desktop you must hold the Ctrl key on the keyboard while you click onto the button to activate its action. The reason is simply that just clicking (without holding the Ctrl key on the keyboard) on an object in Power BI Desktop is only selecting it. When you have published the report to the Power BI Service or to a Power BI Report Server, the user activates the action via an ordinary click.

    Q&A Dialog

    The button described in Figure 1-11 does not open a Q&A visualization, but rather a Q&A dialog (Figure 1-12). This dialog shows you suggested questions on the left (which Power BI Desktop is coming up with on its own). You have the same features in the input field (Ask a question about your data) with small differences:

    You can see the answer not only to the current questions, but also to previous questions you have asked since the dialog was opened or since the questions were cleared, listed below the input field.

    After asking a question you can narrow it down in a second question after you click Ask a related question. A summary of your question is then shown at the bottom of the visual.

    You can clear the list of answers by clicking on Clear.

    You can add the current question to the list on the left by clicking Add this question. If you leave the dialog window with Save and close, these questions are saved with the Power BI Desktop file and replace the standard questions for this dialog. (The questions suggested by default and shown in Figure 1-1 are not influenced, though.)

    You can’t add the answer as a visual to your report.

    ../images/495490_1_En_1_Chapter/495490_1_En_1_Fig12_HTML.jpg

    Figure 1-12

    Q&A dialog opened via Q&A button

    When in doubt, I would choose the Q&A visual (created as visual or by double-clicking the report pane) over the Q&A dialog (created via a Q&A button). The Q&A visual has been reworked with the December 2019 release of Power BI Desktop to cover most of the features of the dialog and can be directly embedded into the report page, without the need to open an extra dialog window.

    Keywords

    We have already seen some possibilities of Q&A in action: getting the value of a measure or a column, filtering on a year, or changing the visual. The first one refers to objects in the data model. The latter two make use of keywords.

    The keywords can be categorized in the following way:

    Aggregates (e.g., total, sum, count, average, largest, smallest)

    Comparison and range (e.g., versus, compared to, in, equal, =, between), top x, conjunctions (e.g., and, or, nor), and contractions (e.g., didn’t)

    Query commands (e.g., sort, ascending, descending), visual types (e.g., as bar, as table; for me most of the standard visualizations worked)

    Beside the keywords you can enter values (concrete values you are looking for, including true, false, and empty), including dates (concrete values in many formats and relative dates, like today, yesterday, previous, x days ago) and times.

    You can find a full list of keywords and values in Microsoft’s online documentation at https://docs.microsoft.com/en-us/power-bi/consumer/end-user-q-and-a-tips. Microsoft does a great job in adding many variations of recognized words. Just try it out (and don’t restrict yourself to the preceding list) to find out which phrases work best for you to get the result you are looking for.

    Synonyms

    Despite the fact that a table, a column, or a measure in a data model can only have one distinct name, in the real world people use different names for the same thing. People in your organization (maybe including yourself) might sometimes refer to the sales amount and at other times to revenue or earnings, but mean the same thing in all three instances. If we have several names for the same thing, those several names are called synonyms.

    When you ask Q&A for revenue in the sample Power BI Desktop file, it will put two red lines underneath, signaling that it does not recognize the word (as it can’t be found in the data model). We have already seen this in Figure 1-8.

    Luckily, Power BI Desktop allows us to enrich our data model with synonyms. The feature is a little bit hidden, though. You have to change to the model view (the third icon from the top on the left side of the screen; see Figure 1-13). There, you can either click on a specific element (e.g., a column or measure) in one of the tables or find the element in the field list on the right of the screen. In the General section of Properties you will find the input field for

    Enjoying the preview?
    Page 1 of 1