Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hey there,
I am using the relationships between two tables to calculate 7-day rolling average of Acquisition Sales. Of course we don't have sales every day, so the table consists of two columns: Date and Aquisition Sales for only the dates that have acquisitions.
To consider the zero-sale days, I created a date table that includes all dates within the requested period, and the dates are linked in the relationships.
The formular I am using is:
@karanka , Try like
AcqSales_RA7 = AVERAGEX(values('Date table'[Date]) , CALCULATE(SUM('Acquisition table'[Acquisition Sales])+0, DATESBETWEEN('Date table'[Date], MAX('Date table'[Date]) - 7, MAX('Date table'[Date]))))
Hey @amitchandak,
Thank you very much for your response.
The way you wrote it gives me the sum of those 7 days (i.e. 3000 in my example). If I devide it by 7, then I get the correct result (i.e. 428). I can't understand why the AVERAGEX dosen't work there, but I could get the final result doing this:
Please let me know if you come up with the reason why your formular gives me the sum instead of average of the 7 days. Thanks!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 36 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 89 | |
| 73 | |
| 66 | |
| 65 |