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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
tomr
New Member

Match Sample Datetime to production run?

Hey Everyone,

 

I have 2 tables of Data, the first which contains the start and end times for a production run as well as the target value for a particular measured variable of the product.

 

Second table represents samples taken from each of those production runs however is limited to just the datetime the sample was taken and the measured level of the variable. I want to match these samples to the production run number from the first table. 

 

Examples of the two tables I want to match below.

 

Any idea about how to go about it?

 

6-11-2018 11-46-14 AM.jpg

 

6-11-2018 12-26-10 PM.jpg

 

 

 

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @tomr

 

If I understand correctly, you want your sample table to carry the production run and target value.

 

If so, please add these two calculated columns.  I have attached a PBIX file.

 

Product Run = 
    MAXX(
        FILTER(
            'Table1',
                'Table1'[Start Time] < EARLIER('Table2'[Datetime Sample]) && 
                EARLIER('Table2'[Datetime Sample]) < 'Table1'[End Time])
    ,[Production Run])

and

 

Target Value = 
    MAXX(
        FILTER(
            'Table1',
                'Table1'[Start Time] < EARLIER('Table2'[Datetime Sample]) && 
                EARLIER('Table2'[Datetime Sample]) < 'Table1'[End Time])
    ,[Target Value])

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @tomr

 

If I understand correctly, you want your sample table to carry the production run and target value.

 

If so, please add these two calculated columns.  I have attached a PBIX file.

 

Product Run = 
    MAXX(
        FILTER(
            'Table1',
                'Table1'[Start Time] < EARLIER('Table2'[Datetime Sample]) && 
                EARLIER('Table2'[Datetime Sample]) < 'Table1'[End Time])
    ,[Production Run])

and

 

Target Value = 
    MAXX(
        FILTER(
            'Table1',
                'Table1'[Start Time] < EARLIER('Table2'[Datetime Sample]) && 
                EARLIER('Table2'[Datetime Sample]) < 'Table1'[End Time])
    ,[Target Value])

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Perfect, thanks for that @Phil_Seamark

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors