Forum Discussion

Boycie92's avatar
Boycie92
Resolver I
6 years ago
Solved

Second Last Date Total

Hi,

 

I am hoping someone can help I have a very simple table.

 

I would like to be able to create a measure that would provide the figure (total) for the second last date available in my data. So, in this scenario 400. Any ideas?

 

Date                  Total

1/1/2020           100 

2/1/2020           150

3/1/2020           400 

4/1/2020           500 

 

Thanks,

Boycie92

 

  • Boycie92 

    measure =
    var _max= maxx(allselected(Table),Table[date])
    return
    calculate(lastnonblankvalue(Table[date],Sum(Table[Total])),Table[Date]<_max)

     

    OR


    measure =
    var _max= maxx(allselected(Table),Table[date])
    return
    calculate(lastnonblankvalue(Table[date],Sum(Table[Total])),filter(allselected(Table),Table[Date]<_max))

4 Replies