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

Create a new price column with the earlier date for a same product name

Hi,

I mean, I would like to insert a "Earlier date Price" column for the same product, in this table

Luiz_0-1600367271909.png

Thanks.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Luiz , Try a new column like

new column =
var _date = maxx(filter(Table, [product] =earlier([product]) && [Date] <earlier([Date])),[Date])
return
var _date = maxx(filter(Table, [product] =earlier([product]) && [Date] =_date ),[price])

 

or the set of these two columns

 

last Date =
maxx(filter(Table, [product] =earlier([product]) && [Date] <earlier([Date])),[Date])

last Price =
maxx(filter(Table, [product] =earlier([product]) && [Date] =earlier([last Date])),[price])

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Try this calculated column formula

=lookupvalue(data[Price],data[date],calculate(max(Data[Date]),filter(Data,Data[Date]<earlier(Data[Date])&&Data[Product]=earlier(Data[Product]))),data[product],data[product])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@Luiz , Try a new column like

new column =
var _date = maxx(filter(Table, [product] =earlier([product]) && [Date] <earlier([Date])),[Date])
return
var _date = maxx(filter(Table, [product] =earlier([product]) && [Date] =_date ),[price])

 

or the set of these two columns

 

last Date =
maxx(filter(Table, [product] =earlier([product]) && [Date] <earlier([Date])),[Date])

last Price =
maxx(filter(Table, [product] =earlier([product]) && [Date] =earlier([last Date])),[price])

It works! Thanks a lot!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.