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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Return last value that is not blank in a column

Hello everyone,

 

I have a table with this form:

 

PROJECT       FINANCIAL_DATE          METRIC           CALENDARISTIC_DATE      [CALCULATED_COLUMN]

x                            x                              x                                 x                                       (solution)

 

In the METRIC column i have some projects that have blank values for that specific calendaristic date. In the [CALCULATED_COLUMN] i want to bring the last populated value looking in the previous dates, and if there is no value, put 0 instead.

I have tried various formula combinations with lastnonblank, earlier, max but i couldn't seem to get it working.

 

Help me please,

Thank you.              

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I am pretty sure i have found the solution, if someone else is interested:

 

[CALCULATED_COLUMN]=
VAR CurrentData=TABLE[Date]
Return
IF(TABLE(METRIC)=BLANK(),
CALCULATE(LASTNONBLANK([METRIC],[METRIC]),FILTER(ALLEXCEPT(TABLE,[PROJECT]),[DATE]<=CurrentData)),[METRIC])

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

I am pretty sure i have found the solution, if someone else is interested:

 

[CALCULATED_COLUMN]=
VAR CurrentData=TABLE[Date]
Return
IF(TABLE(METRIC)=BLANK(),
CALCULATE(LASTNONBLANK([METRIC],[METRIC]),FILTER(ALLEXCEPT(TABLE,[PROJECT]),[DATE]<=CurrentData)),[METRIC])

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors