Power BI basics-editing line

SQL column

Summary of basic knowledge of SQL database

Summary of advanced knowledge of SQL database

This article has a total of 1480 words, estimated reading time: 4 minutes

Edit line

Edit row is to edit the data rows in the report, specific to the row data that needs to be edited, such as deleting error rows, duplicate rows or blank rows.

Example

Taking the Customers table as an example, we will evolve on the basis of this table.

Power BI basics-editing line

Keep rows and delete rows

Click Edit Query-Edit Query in the function menu of the main interface to enter the editing interface, and you can see the reserved row and delete row functions on the menu bar, as follows:

Power BI basics-editing line

Keep the first few lines : this is counting from the first line, keep the specified number of lines, and the lines that are not in the reservation will not be displayed.

For example, we only keep the first three rows in the example. After clicking Keep the first few rows, the following figure appears. If we enter 3, it means that only the first three rows will be kept.

Power BI basics-editing line

The results are as follows:

Power BI basics-editing line

Only 3 rows were retained from the original 12 rows.

Keep the last few lines : count from the last line, keep the specified number of lines, and do not display the ones that are not in the reserved lines.

Power BI basics-editing line

Range of reserved rows : Specify the number of rows from the first row to which row data is retained, and the others are not displayed.

Power BI basics-editing line

Keep duplicates : Keep rows that contain duplicate values ​​in the currently selected column. It is the row that is considered reserved based on the selected column.

For example: we want to see if there are duplicate customer names, select the name column, and click to keep duplicates. Only the rows with duplicates are kept.

Power BI basics-editing line

Keep errors : Only keep the rows with errors in the currently selected column so that we can check what the error is.

Delete the first few lines : In contrast to keeping the first few lines, delete the first specified line and keep the other lines.

Delete the last few lines : from the last line, delete the last few lines

Delete interval line : start from the specified line, delete a specific number of lines

Delete duplicate rows : delete rows with duplicate values ​​in the currently selected column

Delete empty rows : delete rows with empty values ​​in the currently selected column

Delete wrong rows : delete rows with errors in the currently selected column

Use the first row as the row header

Generally, when we import an Excel file, the first row will display the title of the data, but no operation is done when importing it. Power BI will not display the first row as the title of the data by default, as shown below:

Power BI basics-editing line

We choose to use the first row as the heading, then the column headings of the first row will be raised, as shown in the following figure:

Power BI basics-editing line

↓↓↓

Power BI basics-editing line

Combined query

There are two types of combined queries, combined queries and combined new queries.

Power BI basics-editing line

Combined query: Combine this query with the query in another file, similar to the JOIN relational connection in SQL.

For example, we combine the data in Customers and Customers_bak for a combined query, as shown in the following figure:

Power BI basics-editing line

Power BI basics-editing line

We click on the combined query, a dialog box pops up, as shown below:

Power BI basics-editing line

To merge, you must choose which column or several columns to merge, and also choose the type of connection. If it matches, the system will automatically display how many rows are matched. If it does not match, it cannot be merged. Click OK as shown below:

Power BI basics-editing line

But this is not the result we want, we need to continue the operation, click the left and right arrows next to Customer_bak in the figure above, as shown in the following figure:

Power BI basics-editing line

In the pop-up dialog box, select the column to be displayed. The customer ID already exists, so we will not display it, only the zip code and province.

Power BI basics-editing line

The result after clicking OK is as follows:

Power BI basics-editing line

Combine new queries: Combine two queries to form a new query. Others are similar to combined query.

Append query

The append query is divided into append query and append as new query

Append query: Append the query to another file, which can be understood as the UNION operation in SQL.

For example: there are the following two tables Customers1 and Customers2

Power BI basics-editing line

We choose to append the query, and the following dialog box pops up:

Power BI basics-editing line

After clicking OK, the effect is as shown in the figure below:

Power BI basics-editing line****

Customers1 after append query

Append as a new query: Save the results of the two queries after the data is appended to the new query, and other operations are similar to append queries.

annotation

The editing operation of the data row is basically the above, with more content, mainly including retention, deletion, merging and appending. Merging and appending are commonly used in our daily life, especially when dealing with multiple files, which is very helpful. I hope everyone must master it proficiently and lay a solid foundation for future learning!

Guess you like

Origin blog.51cto.com/15057820/2655129