Skip to content

Four places you can visualize data in Microsoft Fabric

Reading Time: 6 minutes

In this post I want to cover four places you can visualize data in Microsoft Fabric for various reasons. Including the fact that knowledge about these different ways can help those preparing for either the DP-600 and DP-700 exams.

Four places you can visualize data in Microsoft Fabric

Most people tend to associate performing visualizations within Microsoft Fabric using Power BI. However, there are many other ways to visualize data in Microsoft Fabric and I want to highlight some of them in this post.

Along the way I share plenty of links. I will start with the way I already mentioned first.

1: Visualizing data with Power BI in Microsoft Fabric

Microsoft Fabric is built on the Power BI architecture. So, it is only logical that you can visualize your data in Power BI reports.

Power BI allows you to visualize data from a variety of sources into rich visualizations. Such as charts, graphs and maps. Plus, you can extend them to include various items such as key metrics and trends.

Typically, to optimize the Power BI report the data is first curated in a semantic model. By using practices such as dimension modelling.

I will not focus too heavily on Power BI in this post. Due to the fact that it has been heavily documented and discussed over the years.

However, I will point out that there are now multiple ways to create Power BI reports in a Microsoft Fabric workspace. Including the below methods:

Power BI example

Below is an example of a Power BI report based on a Power BI Desktop project, which I created for a previous post. With the edit enabled in Microsoft Fabric to emphasize the visualizations possible further.

Visualizing data in Microsoft Fabric with a Power BI report
Visualizing data in Microsoft Fabric with a Power BI report

This Power BI report is in a Fabric workspace that has Microsoft Fabric Git integration configured.

As you can see it is a typical Power BI report visually. However, the metadata for the report and the semantic model is stored in a remote Git repository. Due to the fact that the workspace has Microsoft Fabric Git integration configured.

I cover how the metadata is stored in various other posts. Including a recent post about version control.

One key point to bear in mind when working with Power BI Desktop projects is that only the metadata is stored in the Git repositories. Not the actual data itself. You need to refresh your semantic model to populate the report with data.

Anyway, to avoid Power BI dominating this post I will hastily move onto the next method.

2: Microsoft Fabric notebooks

Another place you can visualize data is in a Microsoft Fabric notebook.

One common way to visualize data in a notebook is to view the results of queries in a chart format. Which will be familiar method to those who have worked with Spark compute in other services over the years.

To show this functionality you can run the below Spark SQL code in a notebook. Which queries Lakehouse tables that contains data extracted from the AdventureWorksDW database.

SELECT YEAR(OrderDate), SUM(OrderQuantity) FROM factinternetsales
GROUP BY YEAR(OrderDate)
ORDER BY YEAR(OrderDate)

You get to see the results in a table format. Plus, next to the table results you can click on the new chart option to create a chart. Which opens a suggested chart based on the data returned.

Suggested chart when visualizing data in a notebook in Microsoft Fabric
Suggested chart when visualizing data in a notebook in Microsoft Fabric

You can change and edit the chart. Plus, you can build your own chart. Below is an edited version of the chart.

Edited chart within a  Microsoft Fabric notebook
Edited chart within a notebook

In the above image you can see straight away that according to the data the sales of the AWC Logo Cap were very high one year.

Utilizing additional libraries in a notebook

For more in-depth customization you can visualize the results by utilizing visualization libraries such as matplotlib and seaborn. For example, you can run the below PySpark code to add the above SQL query to a Spark dataframe.

sqlQuery = "SELECT YEAR(OrderDate), SUM(OrderQuantity),EnglishProductName FROM factinternetsales fs \
                INNER JOIN dimproduct dp ON fs.ProductKey = dp.ProductKey \
                INNER JOIN dimproductsubcategory dpsc on dp.ProductSubCategoryKey = dpsc.ProductSubCategoryKey \
                INNER JOIN dimproductcategory dpc on dpsc.ProductCategoryKey = dpc.ProductCategoryKey \
                WHERE dpc.EnglishProductCategoryName = 'Clothing' \
                GROUP BY YEAR(OrderDate),EnglishProductName \
                ORDER BY YEAR(OrderDate),EnglishProductName"
 df_spark = spark.sql(sqlQuery)
 df_spark.show()

I can then run the below PySpark code convert the dataframe and plot a chart based on the contents of the dataframe.

import seaborn as sns
import matplotlib.pyplot as plt

# Convert Spark dataframe to a Pandas one
df_intsales = df_spark.toPandas()

# Clear the plot area
plt.clf()

# Create a bar chart
ax = sns.barplot(data=df_intsales, x='Year', y='OrderQuantity', hue='ProductName',dodge=True)

# Move the legend more to the right-hand side
plt.legend(loc='right', bbox_to_anchor=(1.7, 0.5))

plt.show()

Which returns the below chart.

Chart returned when using additional libraries in a Microsoft Fabric notebook
Chart returned when using additional libraries

As you can see, there are some great options for those who want to visualize their results whilst working in notebooks. Which can be useful when you want to perform ad hoc queries or when you want to share the logic to create these visualizations in a code-based format.

Microsoft provides additional guidance on various ways you can perform notebook visualizations in Microsoft Fabric. Including how to embed a Power BI report in a notebook.

3: Visualizing data with Real-Time Dashboards in Microsoft Fabric

Next method I want to cover is Real-Time Dashboards. Which is part of the Real-Time Intelligence workload.

Real-Time Dashboards allow you to create interactive dashboards based on data stored in either a KQL database stored in OneLake or in Azure Data Explorer.

You can add tiles to the dashboard which are backed by KQL queries. Like in the below example. Which is based on the exercise to get started with Real-Time Dashboards in Microsoft Fabric.

Visualizing data in Microsoft Fabric with a Real-Time dashboard
Visualizing data in Microsoft Fabric with a Real-Time dashboard

One key point to remember is that these dashboards differ from Power BI reports for various reasons. Including the fact that they are optimized to show real-time data. Which is why this is a very practical way to visualize real-time metrics.

Even though each of the tiles are backed by an individual KQL query the KQL queries can be based off what is known as a base query. Which are reusable code snippets. Allowing you to be more efficient with your KQL queries in your dashboard.

Microsoft provides good documentation on how to create a Real-Time Dashboard. In addition, there is a Microsoft Learn module that covers how to create Real-Time Dashboards in Microsoft Fabric.

4: KQL Querysets

You can create visualizations within a KQL Queryset based on the result of a KQL query.

For example, you can run the below code in a KQL Queryset to create a bar chart similar to the ‘Bikes and docks’ bar chart shown in the last section about Real-Time Dashboards.

bikes
    | where ingestion_time() between (ago(30min) .. now())
    | summarize latest_observation = arg_max(ingestion_time(), *) by Neighbourhood
    | project Neighbourhood, latest_observation, ["Number of bikes"]=No_Bikes, ["Number of empty docks"]=No_Empty_Docks

You can then click on ‘+ Add visual’ and fill in all the relevant details accordingly.

Creating visuals in a KQL Queryset
Creating visuals in a KQL Queryset

As you can see in the previous image, you can also immediately click on both “Pin to dashboard” and “Create Power BI report” for more advanced visualization requirements.

You can also visualize KQL query results with the render operator when working in a KQL Queryset. In other words, by issuing the render term at the end of a KQL statement. Like in the below example.

bikes
    | where ingestion_time() between (ago(30min) .. now())
    | project Neighbourhood, ["Number of bikes"]=No_Bikes, ["Number of empty docks"]=No_Empty_Docks
    | render barchart 
        with (kind=unstacked )

Which returns the below visual.

Creating visuals with the render operator
Creating visuals with the render operator

Doing this is good when you want to quickly visualize the results of a KQL query. Making it ideal for ad hoc analysis of incoming data.

Final words about these four places you can visualize data in Microsoft Fabric

I hope that by sharing four places you can visualize data in Microsoft Fabric helps others realize there are multiple ways to visualize data in Microsoft Fabric.

Because this knowledge can help you. Especially when it comes to performing ad hoc visualizations. Plus, knowledge about these methods can help those preparing for either the DP-600 and DP-700 exams.

Of course, if you have any comments or queries about this post feel free to reach out to me.

Published inMicrosoft FabricPower BI

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *