Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
Can someone advise how to calculate average of previous value and next value when we have a blank value in the Sales field in Power BI.
E.g., Scenario:
Date | Sales |
1-Jul | 10 |
2-Jul |
|
3-Jul | 30 |
4-Jul |
|
5-Jul | 50 |
6-Jul |
|
7-Jul | 70 |
8-Jul |
|
9-Jul | 90 |
10-Jul |
|
Expected Output:
Date | Sales | Expected Sales |
1-Jul | 10 | 10 |
2-Jul |
| 20 |
3-Jul | 30 | 30 |
4-Jul |
| 40 |
5-Jul | 50 | 50 |
6-Jul |
| 60 |
7-Jul | 70 | 70 |
8-Jul |
| 80 |
9-Jul | 90 | 90 |
|
Thanks,
Solved! Go to Solution.
Step 0: I use these data.
Step 1: I add a 'Index' column on Power Query Editor.
- Before -
- After -
Step 2: I add 3 colmuns to the 'DATA' colum on Power BI Desktop.
PrevDay Sales = LOOKUPVALUE(DATA[Sales],DATA[Index],'DATA'[Index]-1)
NextDay Sales = LOOKUPVALUE(DATA[Sales],DATA[Index],'DATA'[Index]+1)
Can this be achieved without Index as it is showing incorrect values when slicer is applied for e.g., on Date, etc.
Step 0: I use these data.
Step 1: I add a 'Index' column on Power Query Editor.
- Before -
- After -
Step 2: I add 3 colmuns to the 'DATA' colum on Power BI Desktop.
PrevDay Sales = LOOKUPVALUE(DATA[Sales],DATA[Index],'DATA'[Index]-1)
NextDay Sales = LOOKUPVALUE(DATA[Sales],DATA[Index],'DATA'[Index]+1)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
142 | |
77 | |
63 | |
51 | |
47 |
User | Count |
---|---|
214 | |
84 | |
61 | |
61 | |
60 |