0
0
Power-biHow-ToBeginner ยท 4 min read

How to Use Dataflow in Power BI: Step-by-Step Guide

In Power BI, use dataflows to prepare and store data in the cloud for reuse across multiple reports. Create a dataflow in the Power BI service by defining entities and transformations using Power Query online, then connect your reports to this dataflow as a data source.
๐Ÿ“

Syntax

A dataflow in Power BI is created and managed in the Power BI service, not by code but through a user interface. The main parts include:

  • Entities: Tables of data you define and transform.
  • Power Query Online: The tool to shape and clean data.
  • Storage: Data is stored in Azure Data Lake Gen2.
  • Connections: Reports connect to dataflows as data sources.

There is no direct code syntax, but the Power Query M language is used inside dataflows for transformations.

powerquery
let
    Source = Sql.Database("server", "database"),
    Sales = Source{[Schema="dbo",Item="Sales"]}[Data],
    FilteredRows = Table.SelectRows(Sales, each [Amount] > 1000),
    RenamedColumns = Table.RenameColumns(FilteredRows,{{"Amount", "SalesAmount"}})
in
    RenamedColumns
๐Ÿ’ป

Example

This example shows how to create a simple dataflow that connects to a SQL database, filters sales over 1000, and renames a column. You do this inside Power Query Online when creating the dataflow.

After saving, you can connect your Power BI Desktop report to this dataflow by choosing Get Data > Power Platform > Power BI dataflows.

powerquery
let
    Source = Sql.Database("myserver.database.windows.net", "SalesDB"),
    SalesTable = Source{[Schema="dbo",Item="Sales"]}[Data],
    FilteredSales = Table.SelectRows(SalesTable, each [Amount] > 1000),
    RenamedColumns = Table.RenameColumns(FilteredSales,{{"Amount", "SalesAmount"}})
in
    RenamedColumns
Output
A table with sales records where Amount is greater than 1000 and the Amount column renamed to SalesAmount.
โš ๏ธ

Common Pitfalls

  • Not refreshing dataflows: Dataflows do not refresh automatically unless scheduled. Remember to set refresh schedules in Power BI service.
  • Incorrect permissions: Ensure you have correct access to source data and workspace to create dataflows.
  • Using dataflows for small datasets: For small or simple data, dataflows may add unnecessary complexity.
  • Confusing dataflows with datasets: Dataflows prepare data; datasets are used in reports. Connect reports to dataflows by creating datasets from them.
none
/* Wrong: Trying to refresh dataflow only in Power BI Desktop (not possible) */
// Correct: Schedule refresh in Power BI service workspace settings.
๐Ÿ“Š

Quick Reference

StepActionNotes
1Go to Power BI service workspaceMust have edit permissions
2Click 'New' > 'Dataflow'Starts dataflow creation wizard
3Add new entities using Power Query OnlineConnect to data sources and transform data
4Save and refresh dataflowSet refresh schedule as needed
5Connect Power BI Desktop to dataflowUse 'Get Data' > 'Power Platform' > 'Power BI dataflows'
6Build reports using dataflow dataReuse data across multiple reports
โœ…

Key Takeaways

Dataflows centralize data preparation in Power BI service for reuse.
Use Power Query Online inside dataflows to shape and clean data.
Schedule dataflow refreshes in Power BI service to keep data current.
Connect Power BI Desktop reports to dataflows via 'Get Data' > 'Power Platform' > 'Power BI dataflows'.
Ensure proper permissions and workspace access to create and use dataflows.