How to Calculate Previous and Next Values in Power BI
Question details
The user needs to calculate an expected value for blank sales records by averaging the values from surrounding dates.

- Product
- Power BI
- Device & OS
- not provided
- Scenario
- Filling blank sales values with averages of previous and next dates in a data report.
- Observed behavior
- Requires specific DAX formulas and data-model guidance to calculate moving averages and fill gaps in the dataset.
Before posting your question in specialized forums, ensure you have your data model schema and a small sample dataset ready to share, as this helps experts provide precise DAX formulas.
Seek Help in the Microsoft Fabric Community
The most effective way to solve complex DAX and data modeling problems is to consult Power BI specialists in the official community.
Advanced row-context calculations, such as finding previous and next values to interpolate blank data, often require specialized DAX functions (like OFFSET, INDEX, or EARLIER) and a properly structured date table. The official Microsoft Fabric Community is the best place to get personalized DAX code for your specific data model.
Navigate to the official Microsoft Fabric Community website in your web browser and locate the Power BI Desktop forums.
Use the search bar to look for terms like 'calculate previous and next values' or 'interpolate blank values DAX' to see if your specific scenario has already been resolved.
If no existing solution fits your needs, create a new topic detailing your table structure, current DAX formula attempts, and the specific requirement to average surrounding dates.

Handle Daily Data Analysis with WPS Office
While Power BI is necessary for complex data modeling, WPS Spreadsheet offers a lightweight and highly compatible alternative for everyday data analysis. You can easily calculate missing values, averages, and generate everyday reports without the steep learning curve of DAX.
- 1. Download and Install: Get WPS Office from the official website and install it on your device.
- 2. Open your dataset: Launch WPS Spreadsheet and import your raw CSV or XLSX sales data.
- 3. Apply average formulas: Use simple spreadsheet functions like =AVERAGE() to reference surrounding cells and quickly interpolate blank values.

Frequently Asked Questions
Can I calculate previous and next values using standard spreadsheet functions?
Yes. In traditional spreadsheet software like Excel or WPS Spreadsheet, you can easily reference previous and next cells using standard row references (for example, using =AVERAGE(B2, B4) to fill a blank in B3). Power BI, however, requires DAX functions since it operates on entire columns and tables rather than specific cell coordinates.
What DAX functions are typically used for finding previous and next values in Power BI?
Advanced Power BI users often utilize window functions such as INDEX, OFFSET, or specific time intelligence functions combined with CALCULATE to retrieve values from previous or subsequent rows based on a sorted order.
Why do I get errors when trying to average previous and next rows in DAX?
DAX does not natively understand 'previous' or 'next' without a clear sorting context. You must have a properly defined Date table and use functions that can evaluate the row context (like creating an index column or using window functions) for the calculations to work correctly.




