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
jo_at_price
Advocate II
Advocate II

get one row of data based on latest filtered date

I know this has to be super easy, I just can't think  of a solution:

I have a simple table, just a dales and a sales amount, on my page i have a date slices, where the user can only select MYD, YTD, Previous Year like so:

jo_at_price_0-1644971270028.png

 

My data looks like this:

Report DateActual Sales Year to Date
2022-02-143.8589
2021-12-3117.6209
2020-12-3119.9421

 

How can I get just the Sales Amount (no addition, no max, just the number on that row) for the latest date on the period? In other words, If the user selects "2021", I'd like to show the sales amount recorded for "2021-12-31" (17.6209), If the user selects "YTD", I wans just the lastest recorded amount for the lastest date in the year (3.8589). Thanks in advance.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@jo_at_price , Last value of the year by date

 

calculate(lastnonblankvalue('Table'[Report Date], sum(Table[Actual Sales])) , Datesytd('Date'[Date]))

 

this can work for a selected duration

 

calculate(lastnonblankvalue('Table'[Report Date], sum(Table[Actual Sales])) )

 

Make sure you are using date table for time intelligence

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@jo_at_price , Last value of the year by date

 

calculate(lastnonblankvalue('Table'[Report Date], sum(Table[Actual Sales])) , Datesytd('Date'[Date]))

 

this can work for a selected duration

 

calculate(lastnonblankvalue('Table'[Report Date], sum(Table[Actual Sales])) )

 

Make sure you are using date table for time intelligence

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.