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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
LiMa92
New Member

Xlookup with not exact values in power bi

Hi,

 

I´ve got a problem in power bi that i´ve been unable to find an answer to or solve yet.

 

So what we have is one excel file and a table from a SQL server with 1 table in each that I have imported in Power BI 

The first table have a column with a unique ID  and a column with unique date and time.

each rows represent a product with manufacturing data for that specific product.

Table looks like this:

 

Product ID    |    Completed time

       1             2022-08-31 06:00

       2             2022-08-31 06:02

       3             2022-08-31 06:05

 

and so on

In the Second table we have a list of when a specific parameter is changed

in this table we have a column for date and time and a column with the changed value.

looking like this: 

LiMa92_0-1661935470645.png

 

What i want to do is to add a column to the first table and put the changed value from the Second table and put that for each unique product that is produced after the changed parameter.

 

the table should look something like this like this:

Product ID    |    Completed time     |    parameter from second table

       1             2022-08-31 06:00           1,85

       2             2022-08-31 06:02           1,85

       3             2022-08-31 06:05           1,85

 

In Excel I would use the Xlookup function to get this to work: =XLOOKUP(I2;$A$2:$A$30;$B$2:$B$30;;-1)

 

In excel it would look like this:

Table with parameter change:

LiMa92_1-1661938879896.png

 

Table with unique products and Xlookup value

LiMa92_2-1661938919874.png

 

I would like to do this directly in Power Bi so we don't get another excel table that we need to keep updated.

 

Thanks in Advance!

1 ACCEPTED SOLUTION
v-yadongf-msft
Community Support
Community Support

Hi @LiMa92 ,

 

This is table1:

vyadongfmsft_0-1662106842433.png

 

This is table2:

vyadongfmsft_1-1662106842434.png

 

Please create a new column in table2:

Column = LOOKUPVALUE('table1'[value],'table1'[Date],'table2'[Date])

vyadongfmsft_2-1662106842436.png

 

If I misunderstood your needs, please contact us in time.

 

Best regards,

Yadong Fang

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

View solution in original post

2 REPLIES 2
v-yadongf-msft
Community Support
Community Support

Hi @LiMa92 ,

 

This is table1:

vyadongfmsft_0-1662106842433.png

 

This is table2:

vyadongfmsft_1-1662106842434.png

 

Please create a new column in table2:

Column = LOOKUPVALUE('table1'[value],'table1'[Date],'table2'[Date])

vyadongfmsft_2-1662106842436.png

 

If I misunderstood your needs, please contact us in time.

 

Best regards,

Yadong Fang

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

Hi Yadong,

 

is it possible to somhow do this when the date and time is not matching exactly in the 2 tables?

in youre example:

I would like to make table 2 check the date in table 1 and if it´s not exactly matching then take the value from the closest older date and use that value instead.

 

Best Regards LM

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.