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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
mmarchioni
Helper I
Helper I

Need to show rows associated with last 2 dates per subject

I am trying to show only the rows associated with the last two dates per subject:

 

mmarchioni_0-1683130611625.png

 

When I try the Top N filter with2, it gives me only the most recent two dates for all subjects.

Help, please.

3 REPLIES 3
amitchandak
Super User
Super User

@mmarchioni , Try new window function

 

TOPN using window = Sumx(KEEPFILTERS(Window(1,ABS,2,ABS, ALLSELECTED('Table'[Subject],'Table'[Date]),ORDERBY('Table'[Date],Desc),,PARTITIONBY('Table'[Subject]))), calculate(Countrows(Table)))

 

 

Learn Power BI: Dynamic TOPN using TOPN/Window and Numeric parameter: https://youtu.be/vm2mdEioQPQ

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

From the questions you have posted it appears we are pulling the same kind of data. It would be interesting to chat and see what you have verse what I have and see if possibly we can help each other. There isn't many of us HLA data peoples out there:-)

Unfortunately I have an older version of PowerBI (pre WINDOW fundtion) and can't upgrade yet. Is there another formula I can try?

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!

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 Solution Authors