Forum Discussion

shihwenwu's avatar
shihwenwu
Frequent Visitor
8 years ago
Solved

previous month and column filter

Hi,

 

I want to create a new column "pre_ops", which get "order product sales" of the previous month (by Yr_month) based on "account".

 

 

Here is my solution:

pre_ops = CALCULATE(MAX(Month_over_Month[order_product_sales]),FILTER(Month_over_Month,Month_over_Month[account]=EARLIER(Month_over_Month[account])),PREVIOUSMONTH(Month_over_Month[Yr_month]))

However, the reason I am using "MAX" is only because I have no idea which function to use to get a value in other column in the same table.

Since in this case there is only one "order product sales" in each month in each account, I can use "MAX" as a way out.

 

Wondering if there are more elegant solution for this kind of issue.

 

Thx

 

1 Reply