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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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