Forum Discussion
Isildur__
3 years agoFrequent Visitor
Return previous month value based on two ID's
Hi Everyone, this one calculation is driving me nuts. For some context, every month a new set of records are added where the values can change or remain consistent. Essentially I just want a ca...
- 3 years ago
hi Isildur__
try to add a calculated column like this:
Value_PM2 = VAR _table = FILTER( TableName, TableName[ProductName/ID]=EARLIER(TableName[ProductName/ID]) &&TableName[CustomerID]=EARLIER(TableName[CustomerID]) ) VAR _date = MAXX( FILTER( _table, TableName[Date]<EARLIER(TableName[Date]) ), TableName[Date] ) RETURN MAXX( FILTER( _table, TableName[Date] = _date ), TableName[Value] )verified and worked like this:
FreemanZ
Super User
3 years agohi Isildur__
try to add a calculated column like this:
Value_PM2 =
VAR _table =
FILTER(
TableName,
TableName[ProductName/ID]=EARLIER(TableName[ProductName/ID])
&&TableName[CustomerID]=EARLIER(TableName[CustomerID])
)
VAR _date =
MAXX(
FILTER(
_table,
TableName[Date]<EARLIER(TableName[Date])
),
TableName[Date]
)
RETURN
MAXX(
FILTER(
_table,
TableName[Date] = _date
),
TableName[Value]
)
verified and worked like this: