Push data into a Power BI dataset

The Power BI API lets you push data into a Power BI dataset. In this article, we show you how to push a Sales Marketing dataset containing a Product table into an existing dataset.

Before getting started, you need an Azure Active Directory (Azure AD) and a Power BI account.

Steps to push data into a dataset

The next section is a general discussion of Power BI API operations that push data.

Power BI API operations to push data

With the Power BI REST API, you can push data sources to Power BI. When an app adds rows to a dataset, dashboard tiles update automatically with the new data. To push data, use the PostDataset and PostRows operations. To find a dataset, use the Get Datasets operation. You can pass a group ID to work with a group for any of these operations. To get a group ID list, use the Get Groups operation.

Here are the operations to push data into a dataset:

You create a dataset in Power BI by passing a JavaScript Object Notation (JSON) string to the Power BI service. To learn more about JSON, see Introducing JSON.

The JSON string for a dataset has the following format:

Power BI Dataset JSON object

{"name": "dataset_name", "tables":
    [{"name": "", "columns":
        [{ "name": "column_name1", "dataType": "data_type"},
         { "name": "column_name2", "dataType": "data_type"},
         { ... }
        ]
      }
    ]
}

For our Sales Marketing dataset example, you would pass a JSON string as shown below. In this example, SalesMarketing is the dataset name, and Product is the table name. After defining the table, you define the table schema. For the SalesMarketing dataset, the table schema has these columns: ProductID, Manufacturer, Category, Segment, Product, and IsCompete.

Example dataset object JSON

{
    "name": "SalesMarketing",
    "tables": [
        {
            "name": "Product",
            "columns": [
            {
                "name": "ProductID",
                "dataType": "int"
            },
            {
                "name": "Manufacturer",
                "dataType": "string"
            },
            {
                "name": "Category",
                "dataType": "string"
            },
            {
                "name": "Segment",
                "dataType": "string"
            },
            {
                "name": "Product",
                "dataType": "string"
            },
            {
                "name": "IsCompete",
                "dataType": "bool"
            }
            ]
        }
    ]
}

For a Power BI table schema, you can use the following data types.

Power BI table data types

Data type Restrictions
Int64 Int64.MaxValue and Int64.MinValue not allowed.
Double Double.MaxValue and Double.MinValue values not allowed. NaN not supported.+Infinity and -Infinity not supported in some functions (for example, Min, Max).
Boolean None
Datetime During data loading, we quantize values with day fractions to whole multiples of 1/300 seconds (3.33 ms).
String Currently allows up to 128 K characters.

Learn more about pushing data into Power BI

To get started pushing data into a dataset, see Step 1: Register an app with Azure AD in the nav pane.

Next Step >

Next steps

Sign up for Power BI
Introducing JSON
Overview of Power BI REST API
More questions? Try the Power BI Community