Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
guy2233
Frequent Visitor

Connection between customer table and orders table

Hi there,
I am trying to figure it out how to associate between customer order date to customer address
this is the customer table:

guy2233_0-1693245222008.png

Each customer has a number of records following an address update, distinguished by an update date.
this is the order table:

guy2233_1-1693245408756.png

I would like to combine combine order table with the customer table to get the appropriate address for that order date.

 

the output sholud look like this:

guy2233_3-1693246134067.png

 

 

Thanks in advanced.

3 REPLIES 3
MFelix
Super User
Super User

Hi @guy2233 ,

 

Do you want to have the information in a table visualization so that you can have a list of adresses or do you want to have the information in a table so you can use it in your dataset in a different way?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix ,

I would like to the the information in the Orders Table so I can use it on the data set.

 

Hi @guy2233 ,

 

For this you need to create a custom function something similar to this:

 

(OrderDate as date, customerid as text) =>

let
    Source = Customers,
    #"Filtered Rows" = Table.SelectRows(Source, each [Dateupdated] <= OrderDate and [Customer ID] = customerid),
    #"Sorted Rows" = Table.Sort(#"Filtered Rows",{{"Dateupdated", Order.Descending}}),
    #"Kept First Rows" = Table.FirstN(#"Sorted Rows",1)
in
    #"Kept First Rows"

 

 

This function gets the information from your customers table and then filter out the latest result based on the order date.

 

Then you just need to use it has a new column on your order table and expan the result for your needs:

MFelix_0-1693827478032.pngMFelix_1-1693827489486.pngMFelix_2-1693827501032.png

 

In my example I only have city but you can expand all the columns.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.