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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have to pick the second max date associated territory for particular policy number from the multiple records
Solved! Go to Solution.
@Anonymous , Try
Last Date = CALCULATE ( MAx ( territory [Date] ), ALLEXCEPT ( territory , territory [policy number] ) )
second max date =
VAR __LAST = [First Purchase]
RETURN CALCULATE ( MIN ( territory[Date] ), ALLEXCEPT ( territory , territory [policy number] ), Dates[Date] < __LAST )
Or have Rank and filter for 2
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415
Hi,
Share a dataset and show the expected result.
@Anonymous
Try create the following column:
Column = Calculate(Max(Table[Date), Filter(Table, Table[Date]<Max(Table[Date])), Allexcept(Table, Table[Police Number]))
Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you This is also working for finding the second max value but not associated value.
Thank you for your help😊
@Anonymous , Try
Last Date = CALCULATE ( MAx ( territory [Date] ), ALLEXCEPT ( territory , territory [policy number] ) )
second max date =
VAR __LAST = [First Purchase]
RETURN CALCULATE ( MIN ( territory[Date] ), ALLEXCEPT ( territory , territory [policy number] ), Dates[Date] < __LAST )
Or have Rank and filter for 2
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415
Thank you I have modified the query as per my data it is working fine.
Thank you so much
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 37 | |
| 36 | |
| 32 | |
| 31 | |
| 29 |
| User | Count |
|---|---|
| 132 | |
| 86 | |
| 85 | |
| 68 | |
| 64 |