The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
The problem: I have two tables. One only contains the Truck ID and each Article on the truck and the other table contains only the delivery date and the article number expected to be delivered on that date.
I want to somehow merge these in order to make a table where I can see the delivery date for each Truck ID. Now imagine that the datasets are much larger then this and some identical articles are on multiple trucks. How could one do that?
One idea I had was to group by TruckID and make a comma delimited cell with all article numbers in ascending order for each Truck_ID.
Then the same Group By on the other table just with the articles grouped on the given dates.
I can do that part but I cant figure out a way to find the date that best correlates to each Truck ID based on the article groups.. I think im overcomplicating this.. If it can be done in DAX I am open to that of course.
Fictitous example below:
Table A
Truck_ID | Article_Number |
PTR-10042304 | 12345 |
PTR-10042304 | 54321 |
PTR-10042304 | 98851 |
PTR-10042304 | 87123 |
PTR-10042304 | 73329 |
GSU-124100510 | 54321 |
GSU-124100510 | 12345 |
GSU-124100510 | 98794 |
GSU-124100510 | 63265 |
GSU-124100510 | 87921 |
Table B
Delivery_Date | Article_Number |
20.09.2025 | 12345 |
20.09.2025 | 54321 |
20.09.2025 | 98851 |
20.09.2025 | 87123 |
20.09.2025 | 73329 |
08.08.2025 | 54321 |
08.08.2025 | 12345 |
08.08.2025 | 98794 |
08.08.2025 | 63265 |
08.08.2025 | 87921 |
Hi @magloons ,
Thanks for reaching out to the Microsoft fabric community forum.
Follow these steps to achieve your desired result.
Construct Grouped Article Lists -
Create the TruckArticles table :
TruckArticles =
SUMMARIZE(
TableA,
TableA[Truck_ID],
"Articles", CONCATENATEX(
VALUES(TableA[Article_Number]),
TableA[Article_Number],
",",
TableA[Article_Number],
ASC
)
)
Create the DateArticles table:
DateArticles =
SUMMARIZE(
TableB,
TableB[Delivery_Date],
"Articles", CONCATENATEX(
VALUES(TableB[Article_Number]),
TableB[Article_Number],
",",
TableB[Article_Number],
ASC
)
)
Create Matching Table -
TruckDateMapping table:
TruckDateMapping =
SELECTCOLUMNS(
FILTER(
CROSSJOIN(TruckArticles, DateArticles),
TruckArticles[Articles] = DateArticles[Articles]
),
"Truck_ID", TruckArticles[Truck_ID],
"Delivery_Date", DateArticles[Delivery_Date]
)
To display the results, use a Table visual and include the following fields:
TruckDateMapping[Truck_ID]
TruckDateMapping[Delivery_Date]
Please find the attached .pbix file for your reference.
Regards,
Sreeteja.
Hi @magloons ,
I hope the information provided above assists you in resolving the issue. If you have any additional questions or concerns, please do not hesitate to contact us. We are here to support you and will be happy to help with any further assistance you may need.
Hi @magloons ,
I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you
In your upstream system add the truck id to the table B. Most likely you will need a Delivery ID too as trucks can make multiple deliveries per day.
I dont have access to the upstream system sadly. These tables are what I have for now. But I do think the dataset is large enough that I could identify the most likely delivery date per TruckID based on the mix of articles on it.
For some reason, you have chosen to not show what you expect for results from the data you have presented.
However, examination of your data shows that the articles are listed in exactly the same order in both tables. If that is truly the case and relevant, all you need to do is add the Delivery_Date column to your Table A. (If that is not the case, you will need to provide what I previously requested along with your logic in developing your result table)
let
//Read in the data tables
SourceA = Excel.CurrentWorkbook(){[Name="TableA"]}[Content],
TableA = Table.TransformColumnTypes(SourceA,{{"Truck_ID", type text}, {"Article_Number", Int64.Type}}),
SourceB = Excel.CurrentWorkbook(){[Name="TableB"]}[Content],
TableB = Table.TransformColumnTypes(SourceB,{{"Delivery_Date", type date}, {"Article_Number", Int64.Type}}),
//Add the delivery date column
#"Add Delivery Date" =
Table.FromColumns(
Table.ToColumns(TableA) &
{TableB[Delivery_Date]},
type table[Truck_ID=text, Article_Number=Int64.Type, Delivery_Date=date])
in
#"Add Delivery Date"
What do you expect for a result generated from the data you have presented?
The data I presented is an example of the tables I have. I dont think one could find the most likely delivery date for a given Truck_ID from what I provided but the real datasets are much larger and possibly large enough to make a correlation if that is possible somehow with Power Query or DAX.
The result should be a table with columns TruckID, Delivery_Date and Article_Number
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...