Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register 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)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
76 | |
56 | |
35 | |
34 |
User | Count |
---|---|
99 | |
56 | |
53 | |
44 | |
40 |