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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Lovebo01
Helper I
Helper I

Show value only for the last quarter with values

Hi everyone,

 

I am trying to show the value for the last quarter selected by the user with values (non blank).

 

To show the value of the last quarter selected by the user I am using this function : 

 
Value Last Quarter =
CALCULATE([Value],
Filter('Date','Date'[Quarter]=MAX('Date'[Quarter])))
 
So I tried to use the LASTNONBLANK function but when I am using it like this :
Value Last Quarter with values =
CALCULATE([Value],
Filter('Date','Date'[Quarter]=LASTNONBLANK('Date'[Quarter],[Value])))
 
It sums all the value for all the quarter. It doesn't sum only the last quarter.
 
Do you know how to do it please ?
 
Thank you for your help,
Lovebo,
1 ACCEPTED SOLUTION

But it gave me an idea for the solution :

 

Value Last Quarter =

var _maxQuarter =MAXX(allselected('Date'),'Date'[Quarter])
var _lastQuarterWithValue = LASTNONBLANK('Date'[Quarter],[Value])
return
CALCULATE([Value],
Filter('Date','Date'[Quarter]=MIN(_maxQuarter,_lastQuarterWithValue)))
 
And this one works good ! 🙂
 
Thank you,

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Lovebo01 , try like

Value Last Quarter =
var _max =MAXX(allselected('Date'),'Date'[Quarter])
return
CALCULATE([Value],
Filter('Date','Date'[Quarter]=_max))

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

But it gave me an idea for the solution :

 

Value Last Quarter =

var _maxQuarter =MAXX(allselected('Date'),'Date'[Quarter])
var _lastQuarterWithValue = LASTNONBLANK('Date'[Quarter],[Value])
return
CALCULATE([Value],
Filter('Date','Date'[Quarter]=MIN(_maxQuarter,_lastQuarterWithValue)))
 
And this one works good ! 🙂
 
Thank you,

Hello,

 

Thank you for your help but it doesn't work, I have only values for the last Quarter, but if the last quarter with some values is the 2nd quarter, it shows nothing.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.