DAX LASTNONBLANK Help!

gnanasek

New Member
Joined
Oct 6, 2016
Messages
3
Hi,

I have the following dataset:

Date Balance
Jan £100
Feb
Mar £50
Apr £70
May
Jun
Jul

I do not have a balance for Feb at the moment. What I would like to see is £100 (I.E. my last non blank value). For May I would like to see £70 because that is what was my balance in April, and then automatically I would like June to be £70 as this was the value in May etc.

Is this possible? Or something similar?

Thanks
Gnana
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You haven't provided enough information to answer. Model design? Do you have a separate calendar table (recommended)? Output pivot layout? LASTNONBLANK could be the right track, but without more info would be just guessing.
 
Upvote 0
Date is coming from a separate date table called DealingDate, Balance is coming from a transactions table. These two tables are joined by a datekey. I am then bringing this into a pivot table in the layout as mentioned above. Please let me know if you need further information. Thanks for the reply
 
Upvote 0
This could be what you are looking for.

Code:
 Measure := LASTNONBLANK( [Balance], DATESYTD( DealingDate[datekey] ) )
 
Upvote 0
Thanks for your reply.

I tried this and I get the error: A table of multiple values was supplied where a single value was expected. I am using Date instead of DateKey because DatesYTD is a date function and my datekey is a number.

Thanks
 
Upvote 0
Wow. Sorry about that. Not sure what I was thinking there as I totally messed that one up. What I should have put down was:
Code:
[COLOR=#333333]Measure := CALCULATE ( [Balance], LASTNONBLANK( DATESYTD( DealingDate[date] , [Balance] ) )[/COLOR]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,600
Members
449,038
Latest member
Arbind kumar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top