Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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:
Month | Category | Price |
1/1/2024 | Car | 1000 |
1/1/2024 | House | 2000 |
2/1/2024 | Car | 900 |
2/1/2024 | House | 2000 |
2/1/2024 | Insurance | 600 |
3/1/2024 | Car | 800 |
3/1/2024 | House | 2000 |
4/1/2024 | Car | 700 |
4/1/2024 | House | 2000 |
5/1/2024 | House | 2500 |
6/1/2024 | Car | 600 |
6/1/2024 | House | 2000 |
I would want the new column to look like this:
Month | Category | Price | Previous Month Value |
1/1/2024 | Car | 1000 | |
1/1/2024 | House | 2000 | |
2/1/2024 | Car | 900 | 1000 |
2/1/2024 | House | 2000 | 2000 |
2/1/2024 | Insurance | 600 | |
3/1/2024 | Car | 800 | 900 |
3/1/2024 | House | 2000 | 2000 |
4/1/2024 | Car | 700 | 800 |
4/1/2024 | House | 2000 | 2000 |
5/1/2024 | House | 2500 | 2000 |
6/1/2024 | Car | 600 | |
6/1/2024 | House | 2000 | 2500 |
If there is no data for the previous month for the given category, the "Previous Month Value" should be null.
Solved! Go to Solution.
@Anonymous
Proud to be a Super User!
@Anonymous
Proud to be a Super User!