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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Karthis476
New Member

Retrieve Previous Month Data from Date Column

Hi,

I have Month Column, Customer ID, Target Date. So I just want retrieve last month Target date for individual customer so I can compare their Target dates revision. Please help me on this.

1 ACCEPTED SOLUTION

I guess you're missing the month-1 filter.

 

Anyway, base on your latest data, you can try below expression.

 

xifeng_L_0-1717985483503.png

 

Result = CALCULATE(MAX('Table'[Target Date]),ALLEXCEPT('Table','Table'[ID]),PARALLELPERIOD('Table'[Month],-1,MONTH))

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

 

View solution in original post

7 REPLIES 7
xifeng_L
Super User
Super User

Hi @Karthis476 

 

You can refer to below demo.

 

xifeng_L_0-1717948988074.png

 

Target Date of Last Month = CALCULATE(MAX('Table'[Target Date]),ALLEXCEPT('Table','Table'[Customer ID]),'Table'[Month Index]=EARLIER('Table'[Month Index])-1)

 

The key is to add an index field to the month so that we can use the current index -1 to get the previous month.

 

Demo - Retrieve Previous Month Data from Date Column.pbix

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

 

Thank you for your response xifeng.

I tried it your approach however I am getting Maximum recorded date in the target column. 

I am looking like below. It should retrieve exact previous month Target for each id.

Please help on this. Thank you 😊 

IMG_20240610_003326.jpg

I guess you're missing the month-1 filter.

 

Anyway, base on your latest data, you can try below expression.

 

xifeng_L_0-1717985483503.png

 

Result = CALCULATE(MAX('Table'[Target Date]),ALLEXCEPT('Table','Table'[ID]),PARALLELPERIOD('Table'[Month],-1,MONTH))

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

 

It's working 🥳

Thank you so much xifeng.. you're a .

Hi Xileng,

I just one more help from you. In the above example I have a customer id column. Suppose if I get a new I'd then this formula should reflect blank in result column. Can you able to help me on this please?

 

The above example is reflecting current month top most date for new id instead of blank.

Sorry, I don't quite understand what you mean. Can you explain it in more detail with pictures?

@xifeng_L  Brilliant solution. You are applying the same method as I am using when it comes to comparing current versus previous. period.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.