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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Martinator007
Frequent Visitor

Finding the last value of a column depending on the selected date

Dear all.

 

I have a problem and did not find something similar.

 

I have a table with IDs:

IDStateDate
2232006.05.2018
2232408.05.2018
2232611.05.2018
2236612.05.2018
2252007.05.2018
2252409.05.2018
2252614.05.2018
2256615.05.2018
3012009.05.2018
3012410.05.2018
3012612.05.2018
3013113.05.2018
3016615.05.2018

 

What I want to have is that I can select a date (e.q. via slicer) and for each ID I get the state (for that specific date or before). That means, selecting the date 13.05.2019 should result in:

IDState
22366
22524
30131

Is there any possiblity to realize that?

 

Thanks a lot in advance and

warm Regards

Martin

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @Martinator007 

 

Create a calendar table. Then we can use this formula

Please see attached file as well

 

Measure =
MAXX (
    TOPN (
        1,
        FILTER ( table1, [Date] <= SELECTEDVALUE ( 'Calendar'[Date] ) ),
        Table1[Date], DESC
    ),
    [State]
)

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

Hi @Martinator007 

 

Create a calendar table. Then we can use this formula

Please see attached file as well

 

Measure =
MAXX (
    TOPN (
        1,
        FILTER ( table1, [Date] <= SELECTEDVALUE ( 'Calendar'[Date] ) ),
        Table1[Date], DESC
    ),
    [State]
)

Hi 

 

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.