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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
AndyB1
New Member

Finding the price of an item on a specific date - No discrete date for change/Using date range

Hi Folks, 

 

Fairly new to PbI, 

I want to create a measure for the price of a product a) in the past week  b) in the past month.

 

My data is organised with multiple products and multiple rows of data for each product which detail price changes effective from upon till. 

 

ProductCreated Date Amount  SystemModStamp
A17/10/2020 $    10.0023/11/2020
A23/11/2020 $    12.0005/12/2020
A05/12/2020 $    11.0010/02/2021
A10/02/2021 $    15.0019/04/2021
A19/04/2021 $    13.00*Todays date function*

 

Is there an easy measure you would recommend? for instance I want to know what the price would be 1 month ago... this would obviosuly be 15.

I've played around with dateAdd and datesbetween but had no luck so far. 

 

Thanks,

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@AndyB1 I would stay away from DATEADD personally, https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

For a month ago, I would do something along the lines of:

Price a month ago Measure =
  VAR __Today = TODAY()
  VAR __Product = MAX('Table'[Product])
  VAR __EOMonthAgo = EOMONTH(__Today,-1)
  VAR __MonthAgoDate = DATE(YEAR(__EOMonthAgo),MONTH(__EOMonthAgo),DAY(__Today)
  VAR __Date = MAXX(FILTER('Table',[Created Date] < __MonthAgoDate && [Product] = __Product),[Created Date])
RETURN
  MAXX(FILTER('Table',[Product] = __Product && [Created Date] = __Date),[Amount])



https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

@AndyB1 I would stay away from DATEADD personally, https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

For a month ago, I would do something along the lines of:

Price a month ago Measure =
  VAR __Today = TODAY()
  VAR __Product = MAX('Table'[Product])
  VAR __EOMonthAgo = EOMONTH(__Today,-1)
  VAR __MonthAgoDate = DATE(YEAR(__EOMonthAgo),MONTH(__EOMonthAgo),DAY(__Today)
  VAR __Date = MAXX(FILTER('Table',[Created Date] < __MonthAgoDate && [Product] = __Product),[Created Date])
RETURN
  MAXX(FILTER('Table',[Product] = __Product && [Created Date] = __Date),[Amount])



https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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