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
JamesB
New Member

Creatiing a calculated column of last date from a related table

Hi All,

First time post, so sorry for the newbie question but I did not see it when looking

I have a products table and a product sales table related 1:n on product number. I want to create a calculated column in the product table which grabs the last sale date for each product in the product sales table, is this possible and if so how?

My assumption is begining with related(lastdate('product Sales'[sold_date])), but this runs in to issues, any help would be much appreciated?
1 ACCEPTED SOLUTION
sdjensen
Solution Sage
Solution Sage

Hi,

 

You could try something like this.

 

LastSalesDate =
CALCULATE(
	MAX( 'product Sales'[sold_date] ),
	FILTER( 
		'product Sales',
		'product Sales[product number] = 'products table'[product number]
	)
)  
/sdjensen

View solution in original post

3 REPLIES 3
sdjensen
Solution Sage
Solution Sage

Hi,

 

You could try something like this.

 

LastSalesDate =
CALCULATE(
	MAX( 'product Sales'[sold_date] ),
	FILTER( 
		'product Sales',
		'product Sales[product number] = 'products table'[product number]
	)
)  
/sdjensen

Thanks for replying this worked, but an even easier solution in the end was a simple MAX (as you suggested) as a measure and then the end user tool would give the correct answer when teh measure was formatted as a date.

@JamesB - did you solve your problem?

/sdjensen

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.