Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Power Query Cookbook Use effective and powerful queries in Power BI Desktop and Dataflows to prepare and transform your data (Janicijevic, Andrea) (z-lib.org).pdf
Скачиваний:
143
Добавлен:
14.08.2022
Размер:
25.9 Mб
Скачать

118 Reshaping Your Data

Using first rows as headers

When working with unstructured data, there is no data structure defined and the schema has to be determined at the Power Query level. In the previous recipe, we saw how data type is detected, while in this one we will see how you can define columns' headers.

Getting ready

In this recipe, you need to download the following file in a local folder:

FactResellerSales2 CSV file

In this example, we will refer to the C:\Data folder.

How to do it

Once you open your Power BI Desktop application, you are ready to perform the following steps:

1.Click on Get Data and select the Text/CSV connector.

2.Browse to your local folder where you downloaded the FactResellerSales2 CSV file and open it. A window with a preview of the data will pop up; click on

Transform Data.

3.The usual Power Query window will pop up and it is easy to note that this data needs to be cleaned because we do not have headers and the first row contains data not useful for any kind of analysis, as seen in the following screenshot:

Figure 4.17 – Power Query data interface

Using first rows as headers 119

4.Click on Remove Rows and then on Remove Top Rows. In the Remove Top Rows window, insert 1 to remove the row we don't need and click on OK:

Figure 4.18 – Remove Top Rows

5. Now click on Use First Row as Headers:

Figure 4.19 – Use First Rows as Headers