Trying to do a lag function to calculate if a specific order is fulfilling back order or inventory
Hello,
Please see below on what I am trying to do. I have open orders that are ranked based on earliest ship date and the ORDQTY. I am looking at the total sales QTY for that model and trying to do a lag calculation to see if a specific line item is fulfilling the outstanding sales qty or going into a negative number which would mean building inventory.
Basically line item 1 would be (1128) which is 104. The next line item would be (10410) which would be 94…and so on.
Thanks
Best Answer

Perhaps you can try a combination of Beast Mode calculations and the window functions? The goal is to calculate the cumulative outstanding quantity and determine if the line item is fulfilling the outstanding sales quantity or going into negative (building inventory).
Running Total Order Quantity
SUM(Ord Qty) OVER (PARTITION BY Model ORDER BY Ship Date)
Outstanding
Sales Qty  SUM(Ord Qty) OVER (PARTITION BY Model ORDER BY Ship Date)
Sort the data by Ship Date and Order Quantity for a running total.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Answers

Perhaps you can try a combination of Beast Mode calculations and the window functions? The goal is to calculate the cumulative outstanding quantity and determine if the line item is fulfilling the outstanding sales quantity or going into negative (building inventory).
Running Total Order Quantity
SUM(Ord Qty) OVER (PARTITION BY Model ORDER BY Ship Date)
Outstanding
Sales Qty  SUM(Ord Qty) OVER (PARTITION BY Model ORDER BY Ship Date)
Sort the data by Ship Date and Order Quantity for a running total.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Categories
 All Categories
 1.6K Product Ideas
 1.6K Ideas Exchange
 1.5K Connect
 1.2K Connectors
 286 Workbench
 4 Cloud Amplifier
 7 Federated
 2.8K Transform
 92 SQL DataFlows
 584 Datasets
 2.1K Magic ETL
 3.6K Visualize
 2.4K Charting
 653 Beast Mode
 37 App Studio
 33 Variables
 638 Automate
 163 Apps
 432 APIs & Domo Developer
 40 Workflows
 3 DomoAI
 31 Predict
 12 Jupyter Workspaces
 19 R & Python Tiles
 378 Distribute
 107 Domo Everywhere
 266 Scheduled Reports
 5 Software Integrations
 104 Manage
 101 Governance & Security
 6 Domo University
 23 Product Releases
 Community Forums
 39 Getting Started
 29 Community Member Introductions
 93 Community Announcements
 4.8K Archive