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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Last date not blank

Hello
 I have this table :

Date  Sales
20/05/2023 400
27/10/2023  500
and I have a slicer that I can slice the data by year/quarter/date
My goal is when i select for example the first quarter of 2023 I should see 400 and when i select the first quarter of 2024 or the all year, I will see the 500.
If I select the third quarter of 2023 or Month 9 in 2023 I will see 400.
I slice the data by dim_date table and the sales in a fact table.
Thank you!
Thank you.

3 REPLIES 3
AllisonKennedy
Super User
Super User

@Anonymous What's the rationale for why you want to see 400 even when the 20/5/2023 date is not included in the selected period? We need a specific rule that we can translate to Power BI in order for this to work.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

For this particular table I should receive data once every few months. That's why I want to spread the data and so I will see the last value that received even if I selected a month/quarter in which I did not received data.

@Anonymous I don't use this function often, but it may work here: LASTNONBLANKVALUE - DAX Guide

 

You'll need to filter for date, so maybe something like this might work: 

[LastValue] = 

VAR _dateSlicer = MAX( dimDate[Date] )

RETURN

CALCULATE( 
LASTNONBLANKVALUE ( dimDate[Date], factTable[Sales] ), 

FILTER( ALL( dimDate ),

dimDate[Date] <= _dateSlicer

)

)


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.