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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Adidas
Helper I
Helper I

Calculate the corresponding price for the latest date in another column

I'm trying to calculate the corresponding price for the latest date in another column.

In this example each group has few items, each item has its own purchase date and price.

My goal is to calculate for each group the latest date and the corresponding price

(Which is not the max price for the group)

Any suggestions, please?

The source table and the desired result:

GroupItem CodeItem Purchase DateItem Price
A11115/01/2019200
A11215/02/2019180
A11315/03/2019150
B21110/02/2018180
B21210/03/2018120
B21310/04/2018140

 

GroupMax Purchase DateItem Price
A15/03/2019150
B10/04/2018140
1 ACCEPTED SOLUTION
carlomoretto
Frequent Visitor

Hi!

 

You can create a measure for the latest price and do without a measure for the latest date by using a variable instead, as suggested here:

https://community.powerbi.com/t5/Desktop/Needing-a-measure-for-last-sales-price/td-p/228280

 

Latest Price =

var MaxDate = CALCULATE(MAX(Table[Item Purchase Date]);ALLEXCEPT(Table;Tabella1[Group]))
return
CALCULATE(SUM(Table[Item Price]);FILTER(Table;Table[Item Purchase Date]=MaxDate))
 
Then you will get something like this:
Latest group price by purchase dateLatest group price by purchase date
 
Cheers!

 

 

View solution in original post

2 REPLIES 2
carlomoretto
Frequent Visitor

Hi!

 

You can create a measure for the latest price and do without a measure for the latest date by using a variable instead, as suggested here:

https://community.powerbi.com/t5/Desktop/Needing-a-measure-for-last-sales-price/td-p/228280

 

Latest Price =

var MaxDate = CALCULATE(MAX(Table[Item Purchase Date]);ALLEXCEPT(Table;Tabella1[Group]))
return
CALCULATE(SUM(Table[Item Price]);FILTER(Table;Table[Item Purchase Date]=MaxDate))
 
Then you will get something like this:
Latest group price by purchase dateLatest group price by purchase date
 
Cheers!

 

 

Thanks, it works!

 

this works also:

 

price of max date =
CALCULATE(
MIN(table[Item Price]),
FILTER(table,table[Item Purchase Date] = MAX(table[Item Purchase Date]))

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.