Forum Discussion

hama21's avatar
hama21
Helper I
3 years ago
Solved

Get last value (last date) when using filter

Hi, I'm have one database that's look like this:

datevalue
jan/224
feb/225
mar/226
abr/227
may/224
jun/225
jul/224
aug/226
sep/22 
oct/22 
nov/22 
dec/22 

 

I want to show the last value, according a filter visual I have in my report. For example, if I filter between january/22 and june/22 I want to return the value as 4 (last date = june/22, according my selection in filter). The problem is, when I'm using this measure calculate(sum(value), date = max(date), it's all returning the value for my last date (december/22) and not respecting the date range filter. Please, could you guys help me how to do this dax measure? 


Thank you!

  • hama21 , I Just Noticed VahidDM , Already replied. Check that first.

     

    Try like

     

    calculate(lastnonblankvalue(Table[Date], Sum(Table[Value])) )

     

    or

     

    calculate(lastnonblankvalue(Table[Date], Sum(Table[Value])), allselected())

4 Replies

  • hama21 , I Just Noticed VahidDM , Already replied. Check that first.

     

    Try like

     

    calculate(lastnonblankvalue(Table[Date], Sum(Table[Value])) )

     

    or

     

    calculate(lastnonblankvalue(Table[Date], Sum(Table[Value])), allselected())