@sql
1 TopicGet values from the previous row - STOCK ON HAND
Hi, Sorry I've posted the same question before but maybe it was not well explained... I'm building a Power BI report to track stock and inventory levels for various items across different locations. My data source is the item ledger entry table from Navision stored in SQL Server. This table captures item movements for each date and location. I've imported the data using a SQL query: now I have a table where I have stock data for days where I had a movement. Example: Posting Date Item No Location Code Quantity 2024-05-10 ITEM-A LOC-1 10 2024-05-11 ITEM-B LOC-2 5 2024-05-12 ITEM-A LOC-1 -2 2024-05-14 ITEM-C LOC-2 15 Now I would like to have stock values for the previous days. This stock value is equal to the stock value from the previous day: Expected results (0 are not necessary): Posting Date Item No Location Code Quantity 2024-05-10 ITEM-A LOC-1 10 2024-05-11 ITEM-A LOC-1 10 2024-05-11 ITEM-B LOC-2 5 2024-05-12 ITEM-A LOC-1 -2 2024-05-12 ITEM-B LOC-2 5 2024-05-13 ITEM-A LOC-1 -2 2024-05-13 ITEM-B LOC-2 5 2024-05-14 ITEM-A LOC-1 -2 2024-05-14 ITEM-B LOC-2 5 2024-05-14 ITEM-C LOC-2 15 I've tried to do that with a SQL query and a cross join but I could not manage it. Is there a way to do that with a DAX function? Thanks!Solved1KViews0likes4Comments