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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I have a table with quarters and weeks, where the sales is a snapshot of the sales at x weeks into the quarter (cumulative). I'd like to get a sum of all sales filtering only for the latest weeks in the quarter (lines in red below).
The issue I'm running into is that the Max-Weeks formula I use tends to only capture the absolute max of all weeks and ignores the max weeks per quarter. The formula I'm working with is below. Any help?
| Qtr | Weeks | Sales |
| Q1 | 1 | 1000 |
| Q1 | 2 | 1200 |
| Q1 | 3 | 1500 |
| Q1 | 4 | 1600 |
| Q2 | 1 | 500 |
| Q2 | 2 | 600 |
| Q2 | 3 | 800 |
| Q2 | 4 | 1000 |
| Q3 | 1 | 200 |
| Q3 | 2 | 400 |
| Q3 | 3 | 600 |
| Q3 | 4 | 800 |
| Q4 | 1 | 200 |
| Q4 | 2 | 300 |
@AudiencesQuesti Try something like:
Measure =
VAR __Table = SUMMARIZE( 'Table', [Qtr], "__MaxWeek", MAX( 'Table'[Week] ) )
VAR __Table1 =
ADDCOLUMNS(
__Table,
"__Sales",
VAR __Qtr = [Qtr]
VAR __Result = SUMX(FILTER('Table', [Qtr] = __Qtr && [Week] = [__MaxWeek]), [Sales])
RETURN
__Result
)
VAR __Result = SUMX( __Table1, [__Sales] )
RETURN
__Result
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 10 | |
| 10 | |
| 8 | |
| 6 | |
| 6 |
| User | Count |
|---|---|
| 24 | |
| 19 | |
| 19 | |
| 15 | |
| 9 |