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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.