top of page
Writer's pictureHari Prasad

Data partitioning is a technique used to divide large datasets into smaller

Here's how to do data partitioning in Power BI using DirectQuery mode:

Step 1: Connect to Data Source in DirectQuery Mode

  1. In Power BI Desktop, click on "Home" in the ribbon.

  2. Click on "Get Data" and select the data source you want to connect to (e.g., SQL Server, Azure SQL Database, etc.).

  3. In the "Navigator" window, select the tables you want to use in your Power BI report.

  4. Click on "Transform Data" to open the Power Query Editor.

Step 2: Enable DirectQuery Mode

  1. In the Power Query Editor, click on "File" in the top-left corner.

  2. Select "Options and settings," and then choose "Options."

  3. In the Options dialog box, go to "Current File" on the left.

  4. In the "Privacy" section, select "Ignore the privacy levels and potentially improve performance" and click "OK."

Step 3: Partition the Data

  1. In the Power Query Editor, go to the "Home" tab in the ribbon.

  2. Click on the "Partition" dropdown menu, and then select "New Query."

  3. In the "Query Settings" pane on the right, rename the query and apply any necessary filters to create a partition. For example, you can filter the data by date ranges, regions, or any other criteria that divide the data into smaller subsets.

Step 4: Load the Partitions

  1. Go back to the main Power Query Editor window by clicking on "Close & Apply" in the ribbon.

  2. Click on "Home" in the ribbon, and then click on "Manage Parameters."

  3. Create a new parameter to define the partitioning criteria. For example, you can create a parameter called "PartitionStartDate" and set it to a specific date value.

  4. Go to the "Model" view in Power BI Desktop.

  5. Select the table for which you want to enable partitioning.

  6. In the "Modeling" tab, click on "New Column" and create a new DAX calculated column using the parameter you defined earlier to filter the data based on the partitioning criteria. For example:

PartitionedData = IF(YourTableName[Date] >= [PartitionStartDate], YourTableName[Sales], BLANK())


7. Repeat steps 3-6 for each partition you want to create.

Step 5: Publish the Report Once you have created the partitions and calculated columns, save the Power BI file and publish it to the Power BI service. In the Power BI service, the data will be queried directly from the data source based on the partitioning criteria, making it more efficient and faster to work with large datasets.

23 views0 comments

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page