Forum Discussion

rachellek's avatar
rachellek
Frequent Visitor
5 years ago

Measure showing latest non-empty value, when later, empty, dates exist

I'm trying to write a measure which shows the most recent non-empty value.

 

My data looks like:

Year Start DateValueTarget
1/1/1926
1/1/2005
1/1/2114
1/1/22 3

 

 

I've tried using
Measure = CALCULATE(sum('Table'[Value]),LASTNONBLANK('Table'[Year Start Date], 1))
 
But it only returns Blank. I would like it to return the 1 from the example. 
 
Is there a way of doing this in DAX?
 
 
 

2 Replies

  • Tanushree_Kapse's avatar
    Tanushree_Kapse
    Icon for Impactful Individual rankImpactful Individual

    Hi rachellek 

     

    You can sort the date... as descending and apply Is not blank filter on the value.

     

     

    Thanks!

     

  • Hi,

    Shouldn't you just be using:

     

    MyMeasure =
    LASTNONBLANK ( 'Table'[Value], 1 )

     

    Regards