Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi everyone,
I am very new to Power BI and I am struggling with a problem I can't figure out how to make it work. There are similar problems on this forum, but they often differ in a subtle way, so I can't figure out how to implement the solutions to my specific case.
So my data contains 3 columns:
| Product | Date | Amount in kg |
| Wheat | 01/01/22 | 1000 |
| Corn | 01/01/22 | 800 |
| Beans | 01/01/22 | 1100 |
| Wheat | 02/01/22 | 1100 |
| Corn | 02/01/22 | 950 |
| Beans | 02/01/22 | 1300 |
| Wheat | 03/01/22 | 1250 |
| Corn | 03/01/22 | 1200 |
| Beans | 03/01/22 | 1500 |
Now I want to add one column that shows the inventory of the product from the previous day ('Amount in kg previous day').
What is the best way to approach this problem?
Thank you!
Solved! Go to Solution.
Hi @Anonymous
You can try
Previous Day Amount =
VAR CurrentDate = Inventory[Date]
VAR T1 =
CALCULATETABLE ( Inventory, ALLEXCEPT ( Inventory, Inventory[Product] ) )
VAR T2 =
FILTER ( T1, Inventory[Date] < CurrentDate )
VAR PreviuosDate =
MAXX ( T2, Inventory[Date] )
VAR T3 =
FILTER ( T2, Inventory[Date] = PreviuosDate )
RETURN
SELECTCOLUMNS ( T3, "Previous Day Amount", Inventory[Amount in kg] )
Hi E_E
You can use this method to return the previous value for a set value:
Hi E_E
You can use this method to return the previous value for a set value:
Thank you, will also play around with this one!
Hi @Anonymous
You can try
Previous Day Amount =
VAR CurrentDate = Inventory[Date]
VAR T1 =
CALCULATETABLE ( Inventory, ALLEXCEPT ( Inventory, Inventory[Product] ) )
VAR T2 =
FILTER ( T1, Inventory[Date] < CurrentDate )
VAR PreviuosDate =
MAXX ( T2, Inventory[Date] )
VAR T3 =
FILTER ( T2, Inventory[Date] = PreviuosDate )
RETURN
SELECTCOLUMNS ( T3, "Previous Day Amount", Inventory[Amount in kg] )
That seems to solve it, thank you very much.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 23 | |
| 12 | |
| 11 | |
| 9 | |
| 8 |