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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

First value of another table base on date

Hi,

I have 2 tables. Table 1 contains IDBoard and the date/time for each:

Capture.JPG

Table 2 contains production run with a start date and end date:

Capture.JPG

 

In table 2 I want to add a new column with the first IDBoard stamp after Start date of table 2. The expecting result should be:

Capture.JPG

Note: Table 1 contains around 30 millions rows!

How can I do that?
Thanks

 

 

 

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

You use this measure:

First IDBoard =
VAR start1 =
    SELECTEDVALUE ( table2[start] )
VAR end1 =
    SELECTEDVALUE ( table2[end] )
RETURN
    CALCULATE (
        MIN ( table1[idBoard] ),
        table1[timeStamp] >= start1
            && table1[timeStamp] <= end1
    )

Best Regards,

Eads

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

4 REPLIES 4
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can create a measure in your second table.

First IDBoard =
VAR start1 =
    SELECTEDVALUE ( table2[start] )
VAR end1 =
    SELECTEDVALUE ( table2[end] )
RETURN
    CALCULATE (
        MIN ( table1[idBoard] ),
        DATESBETWEEN ( table1[timeStamp], start1, end1 )
    )

Then you can get result you want in a visual.3-1.PNG

 

Best Regards,

Eads

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Anonymous
Not applicable

Hi @v-eachen-msft ,

This measure give me an error: duplicate dates dont't work with DATESBETWEEN function. 

Any ideas?
Thanks

Hi @Anonymous ,

 

You use this measure:

First IDBoard =
VAR start1 =
    SELECTEDVALUE ( table2[start] )
VAR end1 =
    SELECTEDVALUE ( table2[end] )
RETURN
    CALCULATE (
        MIN ( table1[idBoard] ),
        table1[timeStamp] >= start1
            && table1[timeStamp] <= end1
    )

Best Regards,

Eads

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
vanessafvg
Super User
Super User

@Anonymous  can you provide the data in  text format?  (ie no pics)





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.