Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

re: need to pull 4 recent dates instead of one newest date

Hello Community,

 

Im trying to use DAX formula to pull recent pay by using following dax query 

 

MaxDatePayroll2 = VAR LatestDate =
CALCULATE ( MAX ( Payroll_Data[Pay End Date] ), ALL ( Payroll_Data ) )
RETURN
IF (Payroll_Data[Pay End Date] = LatestDate, 1, 0 )
 
this only pulls one data. Can you suggest me what I can do to pull 4 recent pay?
1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Anonymous , 

You could apply filter like below or use below measure to see whether it work or not

679.PNG

Measure 3 = if( CALCULATE(DISTINCTCOUNT('Table'[date]), FILTER(ALL('Table'), 'Table'[date]>=MIN('Table'[date])))<=2, SUM('Table'[amount]), BLANK())

680.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
dax
Community Support
Community Support

Hi @Anonymous , 

You could apply filter like below or use below measure to see whether it work or not

679.PNG

Measure 3 = if( CALCULATE(DISTINCTCOUNT('Table'[date]), FILTER(ALL('Table'), 'Table'[date]>=MIN('Table'[date])))<=2, SUM('Table'[amount]), BLANK())

680.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can use RANKX function to get top 4 dates 

https://docs.microsoft.com/en-us/dax/rankx-function-dax

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors