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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Create new column with last month's value for a given category

I want to create a new column that consists of the previous month's value for a given Category.

For example, if the data I'm given is as follows:

MonthCategoryPrice
1/1/2024Car1000
1/1/2024House2000
2/1/2024Car900
2/1/2024House2000
2/1/2024Insurance600
3/1/2024Car800
3/1/2024House2000
4/1/2024Car700
4/1/2024House2000
5/1/2024House2500
6/1/2024Car600
6/1/2024House2000

 

I would want the new column to look like this:

MonthCategoryPricePrevious Month Value
1/1/2024Car1000 
1/1/2024House2000 
2/1/2024Car9001000
2/1/2024House20002000
2/1/2024Insurance600 
3/1/2024Car800900
3/1/2024House20002000
4/1/2024Car700800
4/1/2024House20002000
5/1/2024House25002000
6/1/2024Car600 
6/1/2024House2000

2500

 

If there is no data for the previous month for the given category, the "Previous Month Value" should be null.

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Anonymous 

 

Column = maxx(FILTER('Table','Table'[Category]=EARLIER('Table'[Category])&& 'Table'[Month]=EDATE(EARLIER('Table'[Month]),-1)),'Table'[Price])
 
11.PNG




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
ryan_mayu
Super User
Super User

@Anonymous 

 

Column = maxx(FILTER('Table','Table'[Category]=EARLIER('Table'[Category])&& 'Table'[Month]=EDATE(EARLIER('Table'[Month]),-1)),'Table'[Price])
 
11.PNG




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors
Top Kudoed Authors