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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
PunchBird
Helper V
Helper V

How to get the date of corresponding last nonblank value

Hi,

I have a dataset for which for some dates, the latest values are missing, for example:

date         value1 value2
1/1/2021      3       4
2/1/2021      2       2
3/1/2021      3       6
4/1/2021               7

 

Now I need to get the dates belonging to each last nonblank value. So to be clear: I don't want the value but the date.

So I need:

LastDateValue1 = 3/1/2021

LastDateValue2 = 4/1/2021

 

I tried creating a DAX measure for this with but I can't get it to work. Could anyone please help? Thanks so much!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@PunchBird , Create two measures like

 

maxx(filter(Table, not(isblank(Table[Value1]))),Table[Date])

 

maxx(filter(Table, not(isblank(Table[Value2]))),Table[Date])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi  @PunchBird ,

Here are the steps you can follow:

1. Create measure.

LastDateValue1 =
IF(MAX('Table'[Value1])=BLANK(),
MAXX(FILTER(ALL('Table'),'Table'[Value1]<>BLANK()&&'Table'[date]<=MAX('Table'[date])),[date]),
MAX('Table'[date]))
LastDateValue2 =
IF(MAX('Table'[Value2])=BLANK(),
MAXX(FILTER(ALL('Table'),'Table'[Value2]<>BLANK()&&'Table'[date]<=MAX('Table'[date])),[date]),
MAX('Table'[date]))

2. Result:

vyangliumsft_0-1626932695132.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

It's weird because when I test this I still get 4/1/2021 for value1. The solution also looks a bit cumbersome, compared to what @amitchandak proposed above. But thanks anyway for your help!

PaulDBrown
Community Champion
Community Champion

 

Try:

LastDateValue1 =
MAXX (
    FILTER ( Table, NOT ( ISBLANK ( SUM ( Table[Value1] ) ) ) ),
    Table[Date]
)

and

LastDateValue2 =
MAXX (
    FILTER ( Table, NOT ( ISBLANK ( SUM ( Table[Value2] ) ) ) ),
    Table[Date]
)




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi, thanks! I tested this one but it didn't work... I get 4/1/2021 for both values, which isn't correct 

amitchandak
Super User
Super User

@PunchBird , Create two measures like

 

maxx(filter(Table, not(isblank(Table[Value1]))),Table[Date])

 

maxx(filter(Table, not(isblank(Table[Value2]))),Table[Date])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@Anonymous thanks, this worked, exactly what I needed!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors