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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

Getting values only for the latest product

Hi Power BI Community,

I wanted to get the values/sales of only for the latest product that lunched.

DateProductSales
12/03/202212.03.202201242
18/07/202218.07.202202310
25/08/202225.08.202203156
25/08/202225.08.202204559
10.10.202210.10.2022067-


This is a dummy table and values, but my original dataset has the same formate with product names. As you can see on Date basis new products are lunching. 

Sometimes on same date, new product lunches and I only want to consider the latest one. Like 25.08.2022031 and 25.08.2022045 are lunched on same date, I just want the sales of 045 = 59 sales. And later on in future new product came (10.10.2022067), the selected values should be fetched for that new product.

Thank you

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@Anonymous Try this:

Measure =
  VAR __LastDate = MAX('Table'[Date])
  VAR __Table = FILTER('Table',[Date] = __LastDate)
  VAR __LastProduct = MAXX(__Table,[Product])
RETURN
  SUMX(FILTER(__Table, [Product] = __LastProduct),[Sales])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler ,

This is not working.

This DAX query only getting the sales value of first date only(12.03.2022012). Not the latest date.

I want to get the value of 25.08.2022045. The current latest one


@Anonymous See attached PBIX file below signature. The slightly modified measure below works for me and gets the last date value. Not, the modifications were due to the "-" and thus the assumption that the sales are text.

Measure = 
  VAR __LastDate = MAXX(FILTER('Table',[Sales] <> "-"),[Date])
  VAR __Table = FILTER('Table', [Date] = __LastDate)
  VAR __LastProduct = MAXX(__Table,[Product])
RETURN
  MAXX(FILTER(__Table, [Product] = __LastProduct),[Sales])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler ,

I also tried it in my dataset, but still giving me the total values rather than latest product value

dawoodrana99_0-1663802834630.png

In here you can see that product is changing from Yellow to Blue one
what I need is that when for example blue one lunched, DAX query should start summing pageviews only for blue one and if new product lunches after that it should only sum pageviews for that one
Also, I wanted to consider the pages/products that lunches for the year i.e., 2022 and so on. (But i think this is not necessary)

Thank you

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.