Forum Discussion

petersmith's avatar
petersmith
New Member
7 years ago

Dataflow incremental refresh with primary key

Hi All,

 

Loving dataflows, but would love the ability to do an incremental refresh in more of an 'upsert' style. That is, maintain the uniqueness of a primary key within the dataset. Any ideas on how to do this? I assume it will look something like excuting some sort of M-style merge after the dataflow incremental refresh pulls in more data.


For refrence my table size is ~1 million rows.

15 Replies

  • Hi there

    As it currently stands you have to use a DateKey in order to do the incremental refreshing.

    THis will allow you to possibly only refresh the latest day. And with only having 1 million rows in total, it should be really quick.
  • I assume the meaning of the question is similar to my own..

     

    I can use a Date field in my data to sync only the last day for example. But my 'Upsert' question is will it be able to replace existing data if the primary key shows it already exists?

     

    Lets say I have 10 records, one record created each day. If a user of my system updates record 2 that was originally created 2 says ago but updated today, will the incremental refresh 'Upsert' it? Or will this break the refresh?

     

    When I read about partitions and how incremental refresh seemed to work in original Analysis Services it seems to be purely additive for new data incrementally.

    • GilbertQ's avatar
      GilbertQ
      Super User

      Hi there

      That would work as either by making the incremental refresh look at the DateTime column of the updated data.

      Or you could look at the following below when setting it up

       

      • GilbertQ's avatar
        GilbertQ
        Super User

        Hi there

         

        What you can do is to also enable the option for Detect Changes, where you can update the column based on a date, which will be included in the incremental process

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    I SO GLAD someone asked this question too!

    Currently incremental refresh works for the data was updated based on datetime stamp, say last 10 days. It does not take into consideration the Primary Key that might have been inserted in the past.
    Eg: lets say a "Sales Order" was created 3 months with a Status "Open", but only today its status was changed to "Shipped". Since I am only looking for past 10 days data for incremental refresh, a new Sales Order row gets inserted into the Dataset causing my "Sales Order" table to be duplicated.

    How can we avoid this? Ideally along with the Datetime stamp, there needs to be a option where we specify the Unique Key column too. If incremental refresh contains any of the Unique Keys loaded in the past, they need to be deleted too and reinserted.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hey SamRock,

       

      Any update regarding consideration of primary key when incrementally refreshing? I have a similar situation and I am not sure Power BI dataflows can solve my issue.

      • GilbertQ's avatar
        GilbertQ
        Super User
        Hi there

        Currently incremental refresh only works with dates and unfortunately not with a primary key