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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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]
)

Regards
Zubair

Please try my custom visuals

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]
)

Regards
Zubair

Please try my custom visuals

Hi 

 

 

 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.