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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MRR
New Member

Previous price

Hi All,

 

Tried to find a solution but I cannot seem to find it.

 

I got this tabel:

T_DossierDetail   
    
PartcodePricedatePriceCustldCurrprice
A1-1-202010000100
B1-1-202012000200
C1-1-202010000300
D1-1-202012000400
A2-2-202010000150
B2-2-202012000200
C2-2-202010000300
D2-2-202012000450
A3-3-202010000150
B3-3-202012000250
C3-3-202010000350
D3-3-202012000450

 

I have a measure for last price by month

Price month 03 = CALCULATE(MAX(T_DossierDetail[CurrPrice]),'date'[Month]=3)
 
What I'm looking for is a formule for previous price, so partcode A actual price is 150 and I would like a colum/measure, that gives me a result of 100, because that is the previous price.
 
To make it even harder I would like to have it on partcode and pricecustId.
 
Anyone?

 

1 REPLY 1
amitchandak
Super User
Super User

@MRR , Try a new column like

 

new column =
var _max = maxx(filter(table, [Partcode] = earlier([Partcode]) && [Pricedate] <earlier(Pricedate)),[Pricedate])
return
maxx(filter(table, [Partcode] = earlier([Partcode]) && [Pricedate] =_max ),[Currprice])

 

 

Refer last noncontinuous date logic in this blog for measure

 

Day Intelligence - Last day, last non continous day
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c324...

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors