- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DAX Calculate the MAX of a SUM measure
I have an SSAS tabular model based on Inventory data. The data contains not only the current (i.e. todays) On Hand values, but also 90 days worth of history. Here is a very small sample of data:
I need to create a DAX measure that will return that MAX Qty on Hand for each Material over the 90 days worth of history. In the sample above, the MAX would be 6, because on 2-Dec there was 3 in Loc A and 3 in Loc b.
I have tried the following DAX calculation:
CALCULATE (MAX(Inventory[SAP Qty On Hand]), ALL('Date'))
However, this is returning 3, rather than 6. It needs to aggregate by date before doing the MAX.
Any ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @cmncp, the following measure should do the job:
Max Daily Qty Over 90 Days := VAR currentDate = MAX( table[Dte] ) VAR beginDate = currentDate - 90 RETURN MAXX( CALCULATETABLE( VALUES(table[Date]) , ALLEXCEPT( table[Material] ) , table[Date] >= beginDate ) , CALCULATE( SUM(table[Qty On Hand]) ) )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @cmncp, the following measure should do the job:
Max Daily Qty Over 90 Days := VAR currentDate = MAX( table[Dte] ) VAR beginDate = currentDate - 90 RETURN MAXX( CALCULATETABLE( VALUES(table[Date]) , ALLEXCEPT( table[Material] ) , table[Date] >= beginDate ) , CALCULATE( SUM(table[Qty On Hand]) ) )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
Anonymous
| 08-13-2023 04:37 AM | ||
04-06-2024 10:39 AM | |||
06-20-2024 07:27 AM | |||
05-13-2024 09:51 AM | |||
05-02-2024 11:36 AM |