Breyta

Deila með


Tutorial Part 5: Visualize predictions with a Power BI report

In this tutorial, you'll create a Power BI report from the predictions data that was generated in Part 4: Perform batch scoring and save predictions to a lakehouse.

You'll learn how to:

  • Create a semantic model from the predictions data.
  • Add new measures to the data from Power BI.
  • Create a Power BI report.
  • Add visualizations to the report.

Prerequisites

This is part 5 of 5 in the tutorial series. To complete this tutorial, first complete:

Create a semantic model

Create a new semantic model linked to the predictions data you produced in part 4:

  1. On the left, select your workspace.

  2. On the top left, select Lakehouse as a filter.

  3. Select the lakehouse that you used in the previous parts of the tutorial series.

  4. Select New semantic model on the top ribbon.

    Screenshot of the lakehouse UI home, showing where to select the New semantic model option on the ribbon.

  5. Give the semantic model a name, such as "bank churn predictions." Then select the customer_churn_test_predictions dataset.

    Screenshot of the New semantic model dialog box, showing where to select the correct data and select Continue.

  6. Select Confirm.

Add new measures

Now add a few measures to the semantic model:

  1. Add a new measure for the churn rate.

    1. Select New measure in the top ribbon. This action adds a new item named Measure to the customer_churn_test_predictions dataset, and opens a formula bar above the table.

      Screenshot show creating a new measure.

    2. To determine the average predicted churn rate, replace Measure = in the formula bar with:

      Churn Rate = AVERAGE(customer_churn_test_predictions[predictions])
      
    3. To apply the formula, select the check mark in the formula bar. The new measure appears in the data table. The calculator icon shows it was created as a measure.

    4. Change the format from General to Percentage in the Properties panel.

    5. Scroll down in the Properties panel to change the Decimal places to 1.

      Screenshot show the new Churn Rate measure with properties set.

  2. Add a new measure that counts the total number of bank customers. You'll need it for the rest of the new measures.

    1. Select New measure in the top ribbon to add a new item named Measure to the customer_churn_test_predictions dataset. This action also opens a formula bar above the table.

    2. Each prediction represents one customer. To determine the total number of customers, replace Measure = in the formula bar with:

      Customers = COUNT(customer_churn_test_predictions[predictions])
      
    3. Select the check mark in the formula bar to apply the formula.

  3. Add the churn rate for Germany.

    1. Select New measure in the top ribbon to add a new item named Measure to the customer_churn_test_predictions dataset. This action also opens a formula bar above the table.

    2. To determine the churn rate for Germany, replace Measure = in the formula bar with:

      Germany Churn = CALCULATE(AVERAGE(customer_churn_test_predictions[predictions]),FILTER(customer_churn_test_predictions, customer_churn_test_predictions[Geography_Germany] = TRUE()))
      

      This filters the rows down to the ones with Germany as their geography (Geography_Germany equals one).

    3. To apply the formula, select the check mark in the formula bar.

  4. Repeat the above step to add the churn rates for France and Spain.

    • Spain's churn rate:

      Spain Churn = CALCULATE(AVERAGE(customer_churn_test_predictions[predictions]),FILTER(customer_churn_test_predictions, customer_churn_test_predictions[Geography_Spain] = TRUE()))
      
    • France's churn rate:

      France Churn = CALCULATE(AVERAGE(customer_churn_test_predictions[predictions]),FILTER(customer_churn_test_predictions, customer_churn_test_predictions[Geography_France] = TRUE()))
      

Create new report

Once you're done with all operations, move on to the Power BI report authoring page by selecting Create report on the top ribbon.

Screenshot shows how to create a report.

Once the report page appears, add these visuals:

  1. Select the text box on the top ribbon and enter a title for the report, such as "Bank Customer Churn". Change the font size and background color in the Format panel. Adjust the font size and color by selecting the text and using the format bar.

  2. In the Visualizations panel, select the Card icon. From the Data pane, select Churn Rate. Change the font size and background color in the Format panel. Drag this visualization to the top right of the report.

    Screenshot shows addition of Churn Rate card.

  3. In the Visualizations panel, select the Line and stacked column chart icon. Select age for the x-axis, Churn Rate for column y-axis, and Customers for the line y-axis.

    Screenshot shows addition of a stacked column chart for Age.

  4. In the Visualizations panel, select the Line and stacked column chart icon. Select NumOfProducts for x-axis, Churn Rate for column y-axis, and Customers for the line y-axis.

    Screenshot shows addition of a stacked column chart of NumOfProducts.

  5. In the Visualizations panel, select the Stacked column chart icon. Select NewCreditsScore for x-axis and Churn Rate for y-axis.

    Screenshot shows adding a stacked column chart of NewCreditScore.

    Change the title "NewCreditsScore" to "Credit Score" in the Format panel.

    Screenshot shows changing the title for the chart.

  6. In the Visualizations panel, select the Clustered column chart card. Select Germany Churn, Spain Churn, France Churn in that order for the y-axis.

    Screenshot shows the clustered column chart.

Note

This report represents an illustrated example of how you might analyze the saved prediction results in Power BI. However, for a real customer churn use-case, the you may have to do more thorough ideation of what visualizations to create, based on syour subject matter expertise, and what your firm and business analytics team has standardized as metrics.

The Power BI report shows:

  • Customers who use more than two of the bank products have a higher churn rate although few customers had more than two products. The bank should collect more data, but also investigate other features correlated with more products (see the plot in the bottom left panel).
  • Bank customers in Germany have a higher churn rate than in France and Spain (see the plot in the bottom right panel), which suggests that an investigation into what has encouraged customers to leave could be beneficial.
  • There are more middle aged customers (between 25-45) and customers between 45-60 tend to exit more.
  • Finally, customers with lower credit scores would most likely leave the bank for other financial institutes. The bank should look into ways that encourage customers with lower credit scores and account balances to stay with the bank.

Next step

This completes the five part tutorial series. See other end-to-end sample tutorials: