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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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