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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
hama21
Helper I
Helper I

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!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@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())

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

4 REPLIES 4
amitchandak
Super User
Super User

@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())

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

Thank you @amitchandak Works perfectly! Could you please explain the differece between the measure I was trying and your measures?

 

Thank you!

@amitchandak 

 

  All good mate, you are a hero in the PBI Community.  

😉

 

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

 

VahidDM
Super User
Super User

HI @hama21 

 

Do you use the Slicer visual to set a filter on your report?

Do you use that measure in a card? Have you checked the Slicer (filter) interactions?

 

Read this:

Change how visuals interact in a Power BI report

 

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

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

 

 

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.