Fetch Data from Azure Data Explorer of the Kusto Microsoft Fabric Database in Excel
18K views
Nov 6, 2023
In this video, I demo how to fetch data from azure data explorer of the kusto Microsoft Fabric database in Excel.
View Video Transcript
0:00
Hi everyone, in this video, I'm going to show you how to use Microsoft Excel to connect to datasets in Azure Data Explorer of the Q2 database created in Microsoft Fabric
0:16
Thereafter, I'm going to show you how to load the data into the data model after we perform transformation in the Power Query, write maybe one or two DAX formulas and then create a report in the pivot table
0:29
So let's get started. Now, basically, this F transaction is a data that has already been ingested into the KQL database in Microsoft Fabric
0:39
How do we connect to that data? It's super simple. So I'm going to come to Excel and then in this blank workbook, I'm going to come to the data and then click on Get Data
0:50
And then I want to point to the From Azure and then I want to point to the From Azure Data Explorer
0:56
So I'm going to click on that. Alright, now in the Azure Data Explorer for Keystone, we need the cluster
1:03
So I'm going to go to the KQL, the database, and then I want to point to the database here
1:09
Copy this query URI. So copy to the clayboard, go back to Excel, and then in the cluster, Ctrl V to paste, and
1:18
that's the cluster. And then I can optionally provide the name for the database
1:23
Now the name of the database is the same thing as database
1:26
And then go ahead and click OK. Now Excel is going to require you to sign in to your organization which I have already
1:34
done so we've been able to connect to the F transaction. Amazing
1:39
That is super awesome in Excel. Now I'm going to click on Transform Data to perform some transformative tasks and then
1:47
we can create dimension table from the fact table and then load into the data model
1:53
Now you can see we have the date column as the text or string data type so I going to switch to date Now the moment I do that you can see that we have so many nodes Now this is one of the problems I discover when creating the database and table in the
2:10
KQL in Fabric. Of course, I'm going to flag this later. Now, what I'm going to do is very simple
2:16
I'm just going to clear or filter out the nulls so that I can work with real data without
2:21
any errors. So, there we go. So, we're able to transform data and let's transform this price and this sales to a new
2:29
data type let's use currency and that's awesome so this is going to be the fact
2:34
table so what I'm going to do is I'm going to right click and duplicate so I
2:40
want to create dim tables for the product and payment types I'm going to
2:45
grab these two columns all right right click and choose remove other columns
2:49
that's cool so again I'm going to right click and duplicate this query and then
2:54
I want to get rid of this payment first so remove the column and then this is
2:59
be the deem product okay so let me just remember i'm going to call it deem product okay click enter
3:06
and then i want to get rid of the duplicate record so remove duplicate amazing and then i'm going to
3:13
come to the add column tab and under the generator i want to create an index column so click on this
3:18
drop down and choose from one and i'm going to call here c i'm going to call here c and just
3:23
adding ID so that's gonna be product ID click enter amazing so I'm gonna come
3:29
to these and do the same thing for the payment type so right click remove the
3:34
column and they want to get rid of the duplicate values so the duplicates again
3:40
in add column type want to choose index column from one and could be called it
3:45
on payments tie ID okay click enter that's cool so let's rename these as it
3:54
in payments time okay all right click enter okay and let's get rid of this
4:01
space alright so this is gonna be the dim product and dim payment type and then we have the F transaction the fact table that cool so let come to the home tab i want to close and load to want to load into the power pivot data model so i
4:18
going to choose from the input data wizard only create connection and then want to add to the
4:24
data model the power pivot so click ok and then we're going to see the queries and connection
4:29
taxpaying with three queries being loaded into the data model so let's wait all right so we can
4:37
see 126 rows loaded in the f transaction table and we have six and eight rows in the payment type and
4:46
dim products dim tables respectively so that's cool i'm going to click on this icon the power
4:50
pivot and i'm going to switch to the power pivot the data model and then we can see the table
4:57
which is quite amazing so what i'm going to do is very soon i'm going to come to the diagram view
5:01
and create many to one relationship from the dim tables across to the fact table so i'm going to
5:08
come here and then grab this payment type and connect and it's going to create a one to many
5:13
relationship and again for the product from the dim product i'm going to connect to the product in
5:17
the many side the f transaction facts table that's cool so let's switch to the data view and let's
5:24
just write a simple DAX formula. So I'm going to call this one total sales, then equal to
5:31
and then we can use the name of the DAX formula or function I want to use. I'm going to use the
5:36
sum x and then for the table, we want to iterate over the F transaction table, comma, and then for
5:42
the expression, we want to grab the sales column in the F transaction table, close the bracket
5:49
and we'll click enter on the keyboard, and then we can apply under the formatting, we want to choose
5:54
the GBPound currency symbol and then we can go ahead and create
5:58
Pivotable report. Now we can use the existing worksheet. Click OK and then we can go ahead and search for the total sales
6:07
measure drop in the values and then let want to see payment type grab that from the dim payment type drop in the rows and there we go So we can see the total sales by pivot type and we can just fix this
6:22
The people table design by choosing the report layout Showing tabular form and we can see the descriptive name of the field the payment type and then consider total sales
6:33
now let's switch back to the Power people let's want to see the percentage of
6:39
grand total so I'm gonna come to the formula bar I'm gonna call it percentage
6:44
of GT for grand total now in this case I'm gonna use the divide DAX rules we
6:49
need colon equal to the divide now for the numerator I'm gonna call the
6:55
calculated total sales DAX measure comma and therefore the denominator I'm gonna
7:01
use the calculate DAX function and then for the expression I'm gonna call it
7:04
total sales DAX measure that we created. Now to alter or to modify the filter
7:10
context of the calculator, I'm going to use the all DAX function which returns all the
7:14
rows in the table or all the values in the column. So press the tab key and
7:18
therefore the name of the table I'm going to call the F transaction table, close the
7:22
bracket for the all DAX function and then for the calculate and then for the
7:25
divide DAX and then click enter and that's going to show 1%. Amazing! So we're
7:31
to show and format this number in percentage and there we go so let's switch back using the switch
7:37
to excel and then we can see the calculated dax measure and just drag and drop in the values and
7:45
there we go so we can see the percentage of grand total and we can easily tell that the visa card
7:52
payment type represent 22.28 percent of the 100 percent of the total sales revenue generated so
8:01
basically we've seen how to connect to the azure data explorer of the keystone database and then
8:08
we'll be able to use that data to perform ysis in excel i hope you enjoyed this video if you do
8:13
please like this video share and comment and subscribe to the channel thank you and bye for now
#Data Management