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
Toby001
Regular Visitor

Last "non-blank" value in a "non-sorted" column

Dear community,

In power bi I am using as an example a very simple table with 2 columns (date, value) and need a measure to collect the last non-blank value (0.65) for a card. Maybe I am wrong, but my understanding is that the LASTNONBLANK function works with a "sorted" column only.

Is there any function in the Dax measure to identify the last non-blank value in an "non-sorted" column (such as in the value example)  .. ?

 

datevalue
01.01.20240.89
01.02.20241.34
01.03.20240.65
01.04.2024 
01.05.2024 

 

Appreciate your ideas and input. Many thanks ..

Best

Toby

1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

You can achive the desired effect easily e.g. like this:

Measure 27 =
var _mdate = MAXX(FILTER('Table (40)',not ISBLANK([value])),[date])
RETURN
CALCULATE(MAX([value]),ALL('Calendar'),'Calendar'[date]=_mdate)

You can also use the original table instead of calendar like in this example:

ValtteriN_0-1716900084620.png

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Toby001
Regular Visitor

Looks like I still have to learn some tricks .. :).

Many thanks for your help .. it perfectly works.

ValtteriN
Super User
Super User

Hi,

You can achive the desired effect easily e.g. like this:

Measure 27 =
var _mdate = MAXX(FILTER('Table (40)',not ISBLANK([value])),[date])
RETURN
CALCULATE(MAX([value]),ALL('Calendar'),'Calendar'[date]=_mdate)

You can also use the original table instead of calendar like in this example:

ValtteriN_0-1716900084620.png

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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