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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

August Carousel

Fabric Community Update - August 2024

Find out what's new and trending in the Fabric Community.