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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
jsauber
New Member

In Matrix, I need measure to show last value if calculation is blank

I have a matrix visual displaying item numbers as rows and dates as columns.

The dates are from autocalendar() so that I capture every day.

The source data does not have transactions every day.

Where there are no measure results, the matrix is blank.

All calculations are working as intended.

What I need is to show the last calculated value if, for the day, there were no results.

 

Matrix:

jsauber_0-1695318215045.png

 

Measure:

1.01 Inventory Position =
VAR CurrentItem = SELECTEDVALUE(Combined[MaterialLookup])
VAR CurrentDate = SELECTEDVALUE(Combined[UsageDate])
RETURN
CALCULATE(
    SUM(Combined[UsageQty]),
    FILTER(
        ALL(Combined),
        Combined[MaterialLookup] = CurrentItem &&
        Combined[UsageDate] <= CurrentDate))
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@jsauber , Prefer date table, Example to show last available value

 

calculate(lastnonblankvalue(Table[Date], [Meausre]), filter(all(Date), Date[Date] <= Max(date[Date]) ) )

 

 

DAX functions: lastnonblankvalue , firstnonblankvalue: https://www.youtube.com/watch?v=cN8AO3_vmlY&t=26940s

 

 

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

2 REPLIES 2
amitchandak
Super User
Super User

@jsauber , Prefer date table, Example to show last available value

 

calculate(lastnonblankvalue(Table[Date], [Meausre]), filter(all(Date), Date[Date] <= Max(date[Date]) ) )

 

 

DAX functions: lastnonblankvalue , firstnonblankvalue: https://www.youtube.com/watch?v=cN8AO3_vmlY&t=26940s

 

 

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 so much. This worked. The video was also very useful, thank you for including it.

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.