Show the value X even if the value Y is not exist

Alexsay

New Member
Joined
Feb 2, 2024
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,
Hello experts,

I have a challenge that has been bothering me for some time.
I have two excel tables:
1. A table with daily stock
2. A table with locations (locations master data from WH)
The table with stocks shows me only the locations that have stock and I try to figure out how it can show me even the locations without stock.
I made a merge between the tables and the common value is the name of the location but the values are doubled and I understand that there must be a match between different values
My tables are:

Stock report (the system extract me only lines with stock, for example the location A-1-0 has a storage capacity for 6 palets but the system extract me a report only with stock)
Locations in table stocSSCC (unique code of pallet)
A-1-011
A-1-022
A-1-033

master data of locations. Its 6 lines because the rake has a capacity of six pallets

CodeRoomAreaUsed
A-1-0Drive-In racksAPicking
A-1-0Drive-In racksAPicking
A-1-0Drive-In racksAPicking
A-1-0Drive-In racksAPicking
A-1-0Drive-In racksAPicking
A-1-0Drive-In racksAPicking

I want the result to look like this. I want to see the occupancy level of the location and show me how much space is left

LocationSSCCRoomAreaUsed
A-1-011Drive-In racksAPicking
A-1-022Drive-In racksAPicking
A-1-033Drive-In racksAPicking
A-1-0Drive-In racksAPicking
A-1-0Drive-In racksAPicking
A-1-0Drive-In racksAPicking

Any help, advise will be more than welcome
Thank you!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I'd load each table into power query. In each query group on the location code choosing All rows as the aggregation type and add an index column, then expand the data back out again. You can then merge the queries on Location and index number using a Left Outer join to get all location records back and any matching stock ones. So your Stock query will look something like this (assumes a table called Stock):

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Stock"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"Locations in table stoc"}, {{"Data", each Table.AddIndexColumn(_, "Index", 1), type table}}),
    #"Removed Columns" = Table.RemoveColumns(#"Grouped Rows",{"Locations in table stoc"}),
    #"Expanded Data" = Table.ExpandTableColumn(#"Removed Columns", "Data", {"Locations in table stoc", "SSCC (unique code of pallet)", "Index"}, {"Locations in table stoc", "SSCC (unique code of pallet)", "Index"})
in
    #"Expanded Data"

which produces this:

1711368841466.png


then the Pallets query is similar but with Merge and expand steps:

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Pallets"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"Code"}, {{"Data", each Table.AddIndexColumn(_,"Index", 1), type table}}),
    #"Removed Columns" = Table.RemoveColumns(#"Grouped Rows",{"Code"}),
    #"Expanded Data" = Table.ExpandTableColumn(#"Removed Columns", "Data", {"Code", "Room", "Area", "Used", "Index"}, {"Code", "Room", "Area", "Used", "Index"}),
    #"Merged Queries" = Table.NestedJoin(#"Expanded Data", {"Code", "Index"}, Stock, {"Locations in table stoc", "Index"}, "Stock", JoinKind.LeftOuter),
    #"Expanded Stock" = Table.ExpandTableColumn(#"Merged Queries", "Stock", {"SSCC (unique code of pallet)"}, {"SSCC (unique code of pallet)"})
in
    #"Expanded Stock"

which results in:

1711368914184.png
 
Upvote 0

Forum statistics

Threads
1,215,068
Messages
6,122,950
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top