Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I have set up incremental refresh using Date/Time parametrs. I want the data to be refreshed on 1st of every current month to till date. While setting up the parameters for incremental refresh I have created 2 parameters- RangeStart & RangeEnd. RangeStart is defined in a way that it should start on 1st date of month & RangeEnd to end on todate. The details are Type:Date/Time, Suggested Value: Any value & Current Value: 11/1/2024 12:00:00 AM (RangeStart) & 11/28/2024 12:00:00 AM(RangeEnd). But can I set up these parameters dynamically, so as every month I won't have to set up the Current value manually. I want them to refresh the data from 1st of every current month to todate.
I have tried the Query option within parameter but that to requires a manual current Value, Also worked around the M-code to get the dates dynamically but the Incremental Refresh will only reference to Parameter and not the M-code so had to comment out that step.
Following is the M-code but the dynamic logic is commented-out-
let // Dynamically calculate RangeEnd (current date and time) // Filter rows based on LastModified column |
Hi @rutujakadam_11 ,
To set up dynamic incremental refresh for Power BI:
Create Parameters: Define RangeStart and RangeEnd as Date/Time with dummy values (e.g., 11/1/2024 and 11/28/2024).
Use Dynamic Logic in Query: Update your M-code to calculate dynamic dates but still filter using the parameters for incremental refresh:
CurrentDate = DateTime.LocalNow(), DynamicRangeStart = Date.StartOfMonth(CurrentDate), DynamicRangeEnd = CurrentDate, #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [LastModified] >= RangeStart and [LastModified] <= RangeEnd)
Set Up Incremental Refresh: In Power BI Desktop, configure RangeStart and RangeEnd for incremental refresh and publish the report.
Power BI Service will use your dynamic logic to fetch data from the 1st of the current month to today during refresh.
Please mark this as solution if it helps. Appreciate Kudos.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
26 | |
12 | |
11 | |
11 | |
8 |