Forum Discussion

Cathy99's avatar
Cathy99
New Member
3 years ago

sortByColumn in Push Dataset not working

I am embedding a powerBI report into a website and I need to use push dataset to get live connection. I am creating a Push Dataset using API call:

POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets

with Body

{
    "name""pushdataset_name",
    "tables": [
    {
      "name""liveReport",
      "columns": [         
        {
          "name""DAY_ID",
          "dataType""Int64",
          "summarizeBy":"Count"
        },{
          "name""LOG_DAY",
          "dataType""string",
          "sortByColumn":"DAY_ID",
          "summarizeBy":"None"
        }]}],
    "relationships": [],
    "defaultMode""Push"
  }
According to https://learn.microsoft.com/en-us/rest/api/power-bi/push-datasets/datasets-post-dataset-in-group#column, I use sortByColumn to make column "LOG_DAY" to sort by "DAY_ID". From the above the API call, there's a table definition and you can see I made column "LOG_DAY" to sort by "DAY_ID". The API call is successful, it created push dataset (with no data). But the problem is that sortByColumn is not working. In the push dataset created by API call, Column "LOG_DAY" is still sort by column itself  "LOG_DAY" which is the default value (see screenshot below):
 I have no idea why sortByColumn is not working in push dataset. Any help will be greatly appreciated. 

1 Reply

  • Hi Cathy99,

    This is a known limitation with Push Datasets. Unfortunately, the sortByColumn property in the Push Dataset API schema is not currently supported and is silently ignored by the service — the column sort-by settings must be configured manually in Power BI Desktop after the dataset is created.

    Here is the workaround:

    1. Open your Push Dataset in Power BI Desktop (connect via the Power BI service).
    2. In the Data view, select the LOG_DAY column.
    3. In the Column tools ribbon, click Sort by column and select DAY_ID.
    4. Save and publish the report.

    Note that this manual setting will persist in the report, even as data is pushed to the dataset.

    If you want this behavior to be supported natively via the API, I would encourage you to submit this as a feature request on the Fabric Ideas board.

    Hope that helps!