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!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi community,
I have table:
and need to add column with output:
AveragePrice = last_7_days / City / Product
I think I am doing right average per product:
Average_price_last_7_days =
VAR first_Date =
MAX ('Sales table'[Date of sale])
RETURN
CALCULATE(
AVERAGE('Sales table'[Price]),
ALLEXCEPT('Sales table','Sales table'[Product]),
'Sales table'[Date of sale] <= first_Date
&& 'Sales table'[Date of sale] >= first_Date - 7)
but how to put in one formula with city?
Thanks in advance
Divous
Solved! Go to Solution.
HI @Divous
try
Average_price_last_7_days =
VAR first_Date =
MAX ('Sales table'[Date of sale])
RETURN
CALCULATE(
AVERAGE('Sales table'[Price]),
ALLEXCEPT('Sales table','Sales table'[Product],'Sales table'[City]),
'Sales table'[Date of sale] <= first_Date
&& 'Sales table'[Date of sale] >= first_Date - 7)
Hi, @Divous
Is your problem solved? If pranit828's post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Caiyun Zheng
HI @Divous
try
Average_price_last_7_days =
VAR first_Date =
MAX ('Sales table'[Date of sale])
RETURN
CALCULATE(
AVERAGE('Sales table'[Price]),
ALLEXCEPT('Sales table','Sales table'[Product],'Sales table'[City]),
'Sales table'[Date of sale] <= first_Date
&& 'Sales table'[Date of sale] >= first_Date - 7)
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 53 | |
| 48 | |
| 35 | |
| 14 | |
| 14 |
| User | Count |
|---|---|
| 94 | |
| 79 | |
| 40 | |
| 27 | |
| 25 |