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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi, I am trying to get the second max date per month. Please see below output.
Report Date Second Max Date
5/1/2020 5/20/2020
5/30/2020 5/20/2020
5/20/2020 5/20/2020
6/30/2020 6/15/2020
6/15/2020 6/15/2020
6/01/2020 6/15/2020
My current measure is
Second Max Date = CALCULATE(MAX('Table1'[Report Date]), FILTER('Table1', 'Table1'[Report Date]<>MAX('Table1'[Report Date])))
However, it returns to me this output
Report Date Second Max Date
5/1/2020 6/15/2020
5/30/2020 6/15/2020
5/20/2020 6/15/2020
6/30/2020 6/15/2020
6/15/2020 6/15/2020
6/01/2020 6/15/2020
Please advise how can i get the correct output.
Thanks.
Hi @Anonymous
try
Second Max Date =
var _maxDate = CALCULATE(MAX('Table1'[Report Date]), ALLEXCEPT('Table1', 'Table1'[Report Date].[Month]) )
RETURN
CALCULATE(MAX('Table1'[Report Date]), ALLEXCEPT('Table1', 'Table1'[Report Date].[Month]), 'Table1'[Report Date] < _maxDate)
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 63 | |
| 53 | |
| 42 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 124 | |
| 105 | |
| 44 | |
| 32 | |
| 24 |