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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello,
i have a question and I already tried a lot but It doesnt seem to work.
I have this table created in excel:
I want new columns.
1: If below zero is 1 for one company for a product, then I want to check PER PRODUCT the Over/understock if there is a company that has overstock that could cover the understock from a company (this is what is shown in max overstock). What i want now is to check if the max overstock < Stock needed and if that is the case I want to take stock from other companies as well. And if company B needs all the available stock company D will not get anything. In the new columns I want to show the name of the company(ies) that have overstock to cover the understock of a company.
2. I want a column with the new Over/understock value after allocation.
It should look like this in the end:
ProductCompany NameStockOrdersProductionStock - OrdersOver/UnderstockBelow zero Stock neededAllocation Comp1 Allocation Comp2Allocation Comp3New Over/Understock
| A | Company A | 30 | 43 | 0 | -13 | -13 | 1 | 13 | Company B | 0 | ||
| A | Company B | 20 | 0 | 20 | 0 | 0 | 7 | |||||
| A | Company C | 40 | 20 | 0 | 20 | 20 | 0 | 0 | 20 | |||
| A | Company D | 10 | 20 | 30 | -10 | 20 | 0 | 0 | 20 | |||
| B | Company A | 15 | 15 | 15 | 0 | 0 | 0 | |||||
| B | Company B | 30 | -30 | -30 | 1 | 30 | Company A | Company E | Company C | 0 | ||
| B | Company C | 2 | 6 | -2 | 4 | 0 | 0 | 1 | ||||
| B | Company D | 20 | 80 | 8 | -60 | -52 | 1 | 52 | -52 | |||
| B | Company E | 5 | 7 | 5 | 12 | 0 | 0 | 0 |
Hope thats clear since its a bit hard for me to explain.
Thanks!
best regards,
Marlene
Step 1: Load the Data into Power BI
Step 2: Create a New Column for Over/Understock
In Power Query Editor, add a custom column that calculates the Over/Understock:
[Stock] - [Orders]
Step 3: Allocate Stock from Overstock
Step 4: Create a New Column for Allocation
Step 5: Load Data into Power BI Model
Step 6: Create Visualizations
The exact M code for calculating allocation based on your criteria and merging with the main table will depend on the specifics of your data and requirements. This is a complex task and might require expertise in Power Query and DAX.
It's essential to have a good understanding of Power BI, Power Query, and DAX to achieve the desired result. You may need to consult with a Power BI expert or consider a custom development solution if your requirements are highly complex.
Remember to regularly refresh your data in Power BI to keep your visualizations up-to-date as your source data changes.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 10 | |
| 6 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 13 | |
| 11 | |
| 9 | |
| 8 | |
| 8 |