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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ase
Frequent Visitor

Creating a new column which takes values from another column for previous period

Hi all,

 

I have a problem creating a column/measure which takes the value from another column but for the next period. Below is an illustration of the issue:

 

ase_1-1655393543429.png

 

I tried to create a new column which was basically: Month+1 and then use looupvalue of an IF function but without any success. 

 

Basically I need to have for each product (Apple) the inventory in March and the inventory in April on the same line, so they can be used for visuals. 

 

Could you please help me out?

 

Kind regards,

B

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @ase 

Thanks for reaching out to us.

You can try this, create a new column

Column = CALCULATE(MAX('Table'[Inventory]),FILTER(ALLEXCEPT('Table','Table'[Product]),'Table'[Month]=EARLIER('Table'[Month])+1))

vxiaotang_0-1655804300728.png

Or measure,

Measure = CALCULATE(MAX('Table'[Inventory]),FILTER(ALLEXCEPT('Table','Table'[Product]),'Table'[Month]=MIN('Table'[Month])+1))

vxiaotang_1-1655804359276.png

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xiaotang
Community Support
Community Support

Hi @ase 

Thanks for reaching out to us.

You can try this, create a new column

Column = CALCULATE(MAX('Table'[Inventory]),FILTER(ALLEXCEPT('Table','Table'[Product]),'Table'[Month]=EARLIER('Table'[Month])+1))

vxiaotang_0-1655804300728.png

Or measure,

Measure = CALCULATE(MAX('Table'[Inventory]),FILTER(ALLEXCEPT('Table','Table'[Product]),'Table'[Month]=MIN('Table'[Month])+1))

vxiaotang_1-1655804359276.png

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

ase
Frequent Visitor

This seems too complicated for me. Is there a way to create a simple lookup based on the previous month value?

Greg_Deckler
Community Champion
Community Champion

@ase See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395....
The basic pattern is:
Column = 
  VAR __Current = [Value]
  VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])

  VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
  __Current - __Previous



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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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