Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
28 | |
12 | |
10 | |
10 | |
6 |