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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.