Forum Discussion

ArvindJha's avatar
ArvindJha
Helper III
1 year ago
Solved

Dataflows Incremental Refresh

Hello Team,   I need to implement incremental refresh the scenario is like i have 10 differnt countries in dataset and each country might have data till different date. Say we have data for India ...
  • tharunkumarRTK's avatar
    1 year ago

    ArvindJha 

     

    If the difference in last available dates between countries remains constant, then setting the incremental refresh to the earliest date (e.g., 1st Jan 2025 for India) will ensure that all countries get refreshed correctly. Taking the example you shared, you can set the incremental refresh policy as 

     

    "Refresh Last 2 Months and store last 2 years"  

    this will ensure that all countries data will get refreshed.

     

    However, if the date difference changes dynamically, this approach won't work because some countries might not refresh correctly. To avoid this issue, you need to write the M code in such a way that,

     

    1. it will identify the maximum date available for each country, example code

    LastDatePerCountry = 
        Table.Group(Source, {"Country"}, {{"MaxDate", each List.Max([DateColumn]), type date}})
    

    2. Take the minimum date of MaxDate

    MinofAllMaxDates = List.Min(Table[MaxDate])
    

    3. If MinofAllMaxDates is less than RangeStart parameter then consider MinofAllMaxDates else RangeStart

    4. Then use the RangeStart and RangeEnd paramters to filter your actual table.

     

    https://learn.microsoft.com/en-us/power-query/dataflows/incremental-refresh

    https://learn.microsoft.com/en-us/fabric/data-factory/dataflow-gen2-incremental-refresh

     

    Need a Power BI Consultation? Hire me on Upwork

     

     

     

    Connect on LinkedIn

     

     

     








    Did I answer your question? Mark my post as a solution!
    If I helped you, click on the Thumbs Up to give Kudos.

    Proud to be a Super User!