Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
I want to use DAX to calculate a daily sum of max values grouped by by date and location.
The starting data looks like the table below.
| Date | Location | Value |
| 2022-03-01 | A | 10 |
| 2022-03-01 | B | 20 |
| 2022-03-01 | A | 30 |
| 2022-03-01 | B | 5 |
| 2022-03-02 | A | 20 |
| 2022-03-02 | B | 40 |
| 2022-03-02 | A | 5 |
| 2022-03-02 | B | 10 |
First step is to get max values by date and location | ||
| Date | Location | Max Value |
| 2022-03-01 | A | 30 |
| 2022-03-01 | B | 20 |
| 2022-03-02 | A | 20 |
| 2022-03-02 | B | 40 |
| Second step is to get sum of max values by date | ||
| Date | Sum Max Value | |
| 2022-03-01 | 50 | |
| 2022-03-02 | 60 |
Can this be done in a single DAX Measure?
I already have a DAX measure that calculates a sum of max values by location:
Sum Max Location Values = SUMX( VALUES ( 'Table'[Location] ), CALCULATE( MAX( 'Table'[Values] )))
Solved! Go to Solution.
Sum of max values = SUMX(
ADDCOLUMNS( SUMMARIZE( 'Table', 'Table'[Date], 'Table'[Location]), "@val",
CALCULATE( MAX( 'Table'[Value])) ),
[@val] )
Hi,
Please check the picture down below and the attached pbix file.
One is for creating a new table, and the other is for creating a measure.
Desired table =
VAR stepone =
GROUPBY (
Data,
Data[Date],
Data[Location],
"@maxvalue", MAXX ( CURRENTGROUP (), Data[Value] )
)
VAR steptwo =
GROUPBY (
stepone,
Data[Date],
"@SumMaxValue", SUMX ( CURRENTGROUP (), [@maxvalue] )
)
RETURN
steptwo
Desired measure: =
VAR stepone =
GROUPBY (
Data,
Data[Location],
"@maxvalue", MAXX ( CURRENTGROUP (), Data[Value] )
)
RETURN
IF ( HASONEVALUE ( Data[Date] ), SUMX ( stepone, [@maxvalue] ) )
Sum of max values = SUMX(
ADDCOLUMNS( SUMMARIZE( 'Table', 'Table'[Date], 'Table'[Location]), "@val",
CALCULATE( MAX( 'Table'[Value])) ),
[@val] )
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 11 | |
| 11 | |
| 8 | |
| 8 | |
| 8 |