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 August 31st. Request your voucher.

Reply
sicos79
New Member

Search for the last value in the column

Hi, 

 

I need a solution with DAX in PowerBI. It may be calculated in a measure or new column. 

Search for the last value (not BLANK) in the "VALUE2" column and return it in the "NewField" column. 

 

WEEKSTATUSVALUE1VALUE2NewField
2023KW01Status2 25002500
2023KW01Status175 2500
2023KW03Status1120 2500
2023KW04Status1200 2500
2023KW05Status1230 2500
2023KW06Status1280 2500
2023KW06Status2 27002700
2023KW07Status1410 2700
2023KW08Status1460 2700

 

 

Many Thanks

sicos

3 REPLIES 3
sicos79
New Member

Thanks for the solution. It only works if the value in the "VALUE" field is ascending. It should also work with ascending and descending values.

 

 

 

WEEKSTATUSVALUE1VALUE2NewField
2023KW01Status2 25002500
2023KW01Status175 2500
2023KW03Status1120 2500
2023KW04Status1200 2500
2023KW04Status1200 2500
2023KW04Status2 26002600
2023KW06Status1280 2600
2023KW06Status2 24002400
2023KW07Status1410 2400
2023KW08Status1460 2400

 

Many Thanks

Try this one

 

NewField =
VAR CurrentWeek = 'YourTable'[WEEK]
VAR LastNonBlankValue =
CALCULATE(
LASTNONBLANK('YourTable'[VALUE2], 'YourTable'[VALUE2]),
NOT(ISBLANK('YourTable'[VALUE2])),
FILTER('YourTable', 'YourTable'[WEEK] = CurrentWeek)
)
RETURN
LastNonBlankValue




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






bhanu_gautam
Super User
Super User

@sicos79 , Please try this method

NewField =
CALCULATE(
LASTNONBLANK('YourTable'[VALUE2], 1),
FILTER(
ALL('YourTable'),
'YourTable'[WEEK] <= EARLIER('YourTable'[WEEK]) &&
NOT(ISBLANK('YourTable'[VALUE2]))
)
)

 

Accept as solution and give kudos if it helps




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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.