Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi all,
Beginner here and trying to create a inventory projection report.
I have read a lot of related posts but have been unsuccessful in replicating the formulas.
My database has a tables for stock on hand by SKU and Date for starting stock.
Stock in Transit for showing the stock scheduled to come in by date.
Demand shows the forecasted sales by date.
The final tables should effectively take the beginning stock on hand and deduct the weekly demand and add the stock in transit to show net Stock in that week. If there is not enough stock it should show the actual negative figure.
The model I have managed to put together as attached only shows the wekly figures and does not cumulatively add to the previous weeks net balance.
I would appreciate any help I can get to resolve this. Thanks in advance.
Link to Power Bi file;
Current Visual:
Expected visual:
Solved! Go to Solution.
Hi @Mathewtmp ,
Here is your solution
Steps to perform
1. create an Union table as below
Please note, all the columns will come from the new union table.
In your sample data, the incoming dates are coinsiding with demand dates. So I used demand date as axis which is simple. If it is not the case in your actual table, you need to use a date master.
thanks
If this solves your issue, please accept as solution.
some of your date column is formatted as text. change it to date.
Thank you. And the Secondary Y-Axis is really can't change so it will be above the combo chart? above the bar graph? the value in secondary y-axis is per 10k and the other axis is 500 only that's why the Forecast is hitting some bar line and it is misleading when I see it. Is this really the case? or by design? Thank you.
I am not able to understand your ask. See, in a combo chart, the axix range is set by default based on the minimum and maximum value for primary and secondary axis separately. If you want to see both in same scale, you need to make the axis range dynamic by creating two separate measure for minimum and maximum value and then refering them as Fx.
If this solves your ask. Please accept as solution.
Hi @CampBI ,
the process is same as I explained in the previous thread.
1. I have considered 4 source tables for Inventory, Productio, PO and SO. All these tables three columns name kept common. date, colour and item. values of these tables may have relevant column names.
2. Created a union table:
Union table =
ADDCOLUMNS(
DISTINCT(
union(
DISTINCT(SELECTCOLUMNS(inventory,inventory[Date],inventory[Item],inventory[Color])),
DISTINCT(SELECTCOLUMNS(PO,PO[Date],PO[Item],PO[Color])),
DISTINCT(SELECTCOLUMNS(Production,Production[Date],Production[Item],Production[Color])),
DISTINCT(SELECTCOLUMNS(SO,SO[Date],SO[Item],SO[Color]))
)
)
,
"Inventory",LOOKUPVALUE(inventory[Inventory],inventory[Date],inventory[Date],inventory[Color],inventory[Color],inventory[Item],inventory[Item]),
"PO",LOOKUPVALUE(PO[Arrival],PO[Date],inventory[Date],PO[Color],inventory[Color],PO[Item],inventory[Item]),
"SO",LOOKUPVALUE(SO[Sale Order],SO[Date],inventory[Date],SO[Item],inventory[Item],SO[Color],inventory[Color]),
"Prod",LOOKUPVALUE(Production[Production],Production[Date],inventory[Date],Production[Color],inventory[Color],Production[Item],inventory[Item])
)
3. Created a calculated column in the union table
Stock = 'Union table'[Inventory]+'Union table'[PO]-'Union table'[Prod]-'Union table'[SO]
4. Created a calender table and made relationship with all 4 source tables on date.. (note: dont make any relationship with the union table)
5. Created a measure
Stock forecast =
CALCULATE(sum('Union table'[Stock]),ALLEXCEPT('Union table','Union table'[inventory_Item],'Union table'[inventory_Color]),'Union table'[inventory_Date]<=max('Calendar'[Date]))
6. now take a line & clustered bar chart combo visual. put date from the calender table in x-axis. put Stock forcast measure in the secondary axis. this will display the forcast.
7. Now to create different bars for PO, SO ,Inventory and Production, create four different measure as below and put them in the primary Y-axis.
Inventory_value = CALCULATE(sum('Union table'[Inventory]),'Union table'[inventory_Date]=max('Calendar'[Date]))
SO_value = CALCULATE(sum('Union table'[SO]),'Union table'[inventory_Date]=max('Calendar'[Date]))
Prod_Reserve_value = CALCULATE(sum('Union table'[Prod]),'Union table'[inventory_Date]=max('Calendar'[Date]))
Arrival_value = CALCULATE(sum('Union table'[PO]),'Union table'[inventory_Date]=max('Calendar'[Date]))
8. Slicers will be from union table.
thats it. cheers....
Hi @Rupak_bi I will try to replicate again the steps you have mentioned. Thank you so much. Could you please confirm if I connected it correctly?
dont make any connections. it will work without relations. with connection it may not work.
Thank you @Rupak_bi I tried to replicate the union table, it shows me error like this: Function 'LOOKUPVALUE' does not support comparing values of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the value
Hi @CampBI ,
Based on the sample data, the graph is looking like below. Let me know wheter I am in right track or you need something else
Hi @Rupak_bi Yes that is the correct visualization in line chart, I tried again doing it like what you did but still no hope. I don't know why the other lines (Arrival, Reserved, and Sales Order) is continues and not only showing like static one line like yours. Thank you.
Hi @Rupak_bi Yes! This is the right visualizatiob of the data, how it is come up with that? thank you so much. This is very helpful.
hello @CampBI
What I can understand, your lines are breaking as you dont have consistent data in every week for reserve, SO and arrival and the graph representing correctly. connecting those lines will give a wrong representation. Rather I will suggest to use Matrix visual to represent this. Also in case of line graph, You may customize the chart like... connected line for forcasd and keep only dots for other categories.
If I missunderstood your ask, let me know some mote details of the concern
thanks
Hi @Rupak_bi ,
See sample data below, The requirement should be cumulative or running total for forecast of inventory having the data for Daily qty, arrival, reserved and sales order.
Sum of Inventory - Reserved + Arrival - Sales Order
Seems I can't replicate the running total. Thank you.
Item list table | |||||
Item | Color | Qty | Inventory(today date only) | ||
A12 | Black | 34 | 6/5/2025 | ||
A12 | Blue | 25 | 6/5/2025 | ||
A13 | Black | 6 | 6/5/2025 | ||
Purchase Order(Arrival Table) | |||||
Item | Color | Qty | arrival Date | ||
A12 | Black | 100 | 7/25/2025 | ||
A12 | Blue | 10 | 6/20/2025 | ||
A13 | Black | 16 | 6/30/2025 | ||
Sales Order Table | |||||
Item | Color | Qty | Date | ||
A12 | Black | 3 | 6/11/2025 | ||
A12 | Blue | 47 | 6/22/2025 | ||
A13 | Black | 78 | 6/28/2025 | ||
Production (Reserved Table) | |||||
Item | Color | Qty | Date | ||
A12 | Black | 2 | 6/5/2025 | ||
A12 | Blue | 3 | 6/22/2025 | ||
A13 | Black | 6 | 6/28/2025 | ||
Calendar Table(Date Table) | |||||
Calendar = CALENDAR (DATE (2024, 1, 1), DATE (2026, 12, 31)) |
Hi @CampBI ,
Thanks for sharing sample data. Can you plz share the image of expected visual for better understanding.
Here it is
Thank you.
Hi Rupak,
Thanks for replying. I am assuming you meant the tables in the database?
If so please see below the the same as text.
Table SOH
Date | Part No | Qty |
17/02/2025 | A11 | 1000 |
17/02/2025 | O11 | 500 |
Table SIT
Date | Part No | PO Qty |
10/03/2025 | A11 | 250 |
14/04/2025 | A11 | 250 |
19/05/2025 | A11 | 250 |
24/02/2025 | O11 | 125 |
3/03/2025 | O11 | 125 |
7/04/2025 | O11 | 125 |
12/05/2025 | O11 | 125 |
9/06/2025 | O11 | 125 |
Table Demand
Date | Part No | Demand |
17/02/2025 | A11 | 250 |
24/02/2025 | A11 | 250 |
3/03/2025 | A11 | 250 |
10/03/2025 | A11 | 250 |
17/03/2025 | A11 | 250 |
24/03/2025 | A11 | 250 |
31/03/2025 | A11 | 250 |
7/04/2025 | A11 | 250 |
14/04/2025 | A11 | 250 |
21/04/2025 | A11 | 250 |
28/04/2025 | A11 | 250 |
5/05/2025 | A11 | 250 |
12/05/2025 | A11 | 250 |
19/05/2025 | A11 | 250 |
26/05/2025 | A11 | 250 |
2/06/2025 | A11 | 250 |
9/06/2025 | A11 | 250 |
17/02/2025 | O11 | 125 |
24/02/2025 | O11 | 125 |
3/03/2025 | O11 | 125 |
10/03/2025 | O11 | 125 |
17/03/2025 | O11 | 125 |
24/03/2025 | O11 | 125 |
31/03/2025 | O11 | 125 |
7/04/2025 | O11 | 125 |
14/04/2025 | O11 | 125 |
21/04/2025 | O11 | 125 |
28/04/2025 | O11 | 125 |
5/05/2025 | O11 | 125 |
12/05/2025 | O11 | 125 |
19/05/2025 | O11 | 125 |
26/05/2025 | O11 | 125 |
2/06/2025 | O11 | 125 |
9/06/2025 | O11 | 125 |
Table Part
Part No | Part Name |
A11 | Apples |
O11 | Oranges |
Hi @Mathewtmp ,
Here is your solution
Steps to perform
1. create an Union table as below
Please note, all the columns will come from the new union table.
In your sample data, the incoming dates are coinsiding with demand dates. So I used demand date as axis which is simple. If it is not the case in your actual table, you need to use a date master.
thanks
If this solves your issue, please accept as solution.
Hi Rupak, I find your solution helpful with my current data scenario. But I dont have date for my Stock on hand (SOH) our inventory for stock on hand is counted at the end of the month.
This is my current visual how could I get the line connected to each other where my data for each legend is in different table.
Date table (created date table)
Item No column and Invenory count (unique distinct table, with coulmn count of inventory, which is counted end of the month)
For Reserved (table 1) (production)
For Arrival (table 2) (stock to be arrived)
For Sales Order (table 3) (Order items with date)
For Forecast it is just a measure where , Sum of Inventory + Arrival - Reserved - Sales Order
Current problem is the line is broken since the data comes from different table each category
Inventory is end of month only count
Thank you.
Hi @Rupak_bi , I find your solution helpful with my current data scenario. But I dont have date for my Stock on hand (SOH) our inventory for stock on hand is counted at the end of the month.
This is my current visual how could I get the line connected to each other where my data for each legend is in different table.
Date table (created date table)
Item No column and Invenory count (unique distinct table, with coulmn count of inventory, which is counted end of the month)
For Reserved (table 1) (production)
For Arrival (table 2) (stock to be arrived)
For Sales Order (table 3) (Order items with date)
For Forecast it is just a measure where , Sum of Inventory + Arrival - Reserved - Sales Order
Current problem is the line is broken since the data comes from different table each category
Inventory is end of month only count
Thank you.
Hi @Rupak_bi I find your solution very helpful with my current scenario. I would like also to ask how could I get the measure of my SOH stock on hand when my data for Current Stock is Data every end of the month, since the inventory will be the end of month I don't have any date table for that.
My visual should show in weekly and month (hierarchy), see photo for current visual.
_________
Data:
Inventory(Count per item every end of month) + Arrival(orders from the vendor with date) - Reserved(for production with date) - Sales Order(all items with date)
________
Inventory + Jan Arrival - Reserved - SO = Forecast
Forecast Jan + Feb Arrival - Reserved - SO = Forecast
Forecast Feb + Mar Arrival - Reserved - SO = Forecast
Thank you.
Hi @Rupak_bi ,
Thank you so much for your help with the solution. It works perfectly. 🙂
Much appreciated.
Cheers,
Mat
User | Count |
---|---|
17 | |
16 | |
14 | |
13 | |
13 |
User | Count |
---|---|
14 | |
12 | |
12 | |
8 | |
7 |