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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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.

2 REPLIES 2
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

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.