Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hi Community,
I am new to Power BI and hence I'd need help with DAX Formulas.
I have two columns 1) Week (the date values are in 7 days interval) 2) Quantity
I would need the Minimum, Maximum and Average of Quantity based on the week column(Precisely past 6 weeks from the current week) - I will be using these aggregates in the Line values in a chart over the weeks. My question is:
1) Do I create a Measure or a new column
2) Syntax of the Dax query would be helpful.
Thanks 🙂
Hopefully this should set you on your way:
SixWeeksHence = lastdate(DATESINPERIOD(quantityTable[Week],calculate(firstdate(quantityTable[sixWeeksPrevious])),7*7,day))
FromDate = FIRSTDATE(DATESINPERIOD(quantityTable[Week],calculate(firstdate(quantityTable[sixWeeksPrevious])),7*7,day))
MinQuant =
MINx(
filter(quantityTable,
quantityTable[Week] < earlier(quantityTable[SixWeeksHence]) &&
quantityTable[Week] >= earlier(quantityTable[FromDate]))
,quantityTable[Quantity])
AvgQuant =
AVERAGEX(
filter(quantityTable,
quantityTable[Week] < earlier(quantityTable[SixWeeksHence]) &&
quantityTable[Week] >= earlier(quantityTable[FromDate]))
,quantityTable[Quantity])
MaxQuant =
MAXX(
filter(quantityTable,
quantityTable[Week] < earlier(quantityTable[SixWeeksHence]) &&
quantityTable[Week] >= earlier(quantityTable[FromDate]))
,quantityTable[Quantity])
Data in PBI:
Data in Excel confirming results:
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |