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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
GiuGee
Frequent Visitor

Vlookup duplicate with aproximate values

 

Hello,

 

I have a table with KM and SB and I need to know the subdivision, according to another table

 

TremKMSB
H17170,1LEB
D22133,6LAR
W03301,302ZSN
H2181,526NPV
U25152,5LGI
U25170,1LEB
H9983,851NOR
H37223,109NJO
Z15338,57NCN

  

EquipamentoKMIKMFSubdivisãoNomeSubdivisãoEstação
9/170400-170760tg170,4170,769IGUAÇU - UVARANASLEB
9/170760-170803cv170,76170,8039IGUAÇU - UVARANASLEB
9/170803-170880tg170,803170,889IGUAÇU - UVARANASLEB
20/013040-013150tg13,0413,1520CORVO - ESTRELANOR
21/079554-079913cv79,55479,91321GENERAL LUZ - ROCA SALESNPV
21/079913-080710tg79,91380,7121GENERAL LUZ - ROCA SALESNPV
21/080710-081371cv80,7181,37121GENERAL LUZ - ROCA SALESNPV
21/081371-082217tg81,37182,21721GENERAL LUZ - ROCA SALESNPV
21/082217-082500cv82,21782,521GENERAL LUZ - ROCA SALESNPV
21/082800-083220cv82,883,2221GENERAL LUZ - ROCA SALESNOR
21/083220-084200tg83,2284,221GENERAL LUZ - ROCA SALESNOR
77/300000-300100cv300300,177RUBIAO JUNIOR - BAURUZSN
77/300100-300500tg300,1300,577RUBIAO JUNIOR - BAURUZSN
77/300500-300745cv300,5300,74577RUBIAO JUNIOR - BAURUZSN
77/300745-300860tg300,745300,8677RUBIAO JUNIOR - BAURUZSN

 

I want to know the name of the equipment and the Subdivisão. The KM in the first table is between the values of the second table.

 

Sorry my english. It is not my native language.

 

Someone can help me?

1 ACCEPTED SOLUTION

@GiuGee

 

Please see file attached

 

vlup.png


Regards
Zubair

Please try my custom visuals

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Once a relationship is created between two tables, add a new column in second table using the following dax:

 

=Related(FirstTableName[ColumnName])

 

In this case, I assume that KM is & KMI are related between the two fields. 

 
 

I can't relate the 2 tables, because there are no columns with unique values.

The KM of the first table must be >= KMI and <KMF from the second table

Anonymous
Not applicable

You can create a column using IF or Lookupvalue statements too.

 

I would not do it justice to list the options here but see

 

IF Lookup with lookup table 

 

lookup table

 

 

@GiuGee

 

You can use this column in Table 1 to get all equipments in Table 2 that fall in the range

 

Column =
CONCATENATEX (
    CALCULATETABLE (
        VALUES ( Table2[Equipamento] ),
        FILTER ( Table2, Table1[KM] >= [KMI] && Table1[KM] <= [KMF] )
    ),
    [Equipamento],
    ", "
)

 

or you can use this column if you want any of the matching equipments

 

Column 2 =
CALCULATETABLE (
    FIRSTNONBLANK ( Table2[Equipamento], 1 ),
    FILTER ( Table2, Table1[KM] >= [KMI] && Table1[KM] <= [KMF] )
)

 


Regards
Zubair

Please try my custom visuals

@GiuGee

 

Please see file attached

 

vlup.png


Regards
Zubair

Please try my custom visuals

This has been very helpfull.

But it's missing the SB as parameter

 

The "trem" H99 "SB" NOR should have the "Equipamento" 21/083220-084200tg but it's bringing 77/300500300745cv instead.

 

SB it's the location and must the same in both tables.

How can I look between de Km's and on the exact location?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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