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
ekor-sembilan
Frequent Visitor

Lookupvalue

Hello,

 

Hi, I am fairly new to Power BI  and have a problem I cannot solve, I'm facing a problem when trying to find the vehicle data using the following table information.
I need a measure that I can get the vehicle data into the target table.

 

Thank you for your help.

 

Here is the information :

 

Tabel 1 
VehicleIDUserId
CAR73e73f05
CAR634abdc1
BIKE5d2f1ebb
BIKE465b85d0
BIKE3bd84da7
MOTORBIKEd3ed03ad

 

 

Table 2 
VehicleIDVechicle
BIKEBike
CARCar
ECARElectric car
MOTORBIKEMotorbike

 

Tabel 3 
UserIdVehicle
d3ed03ad 
5d2f1ebb 
465b85d0 
73e73f05 
3bd84da7 
634abdc1 

 

Here is my target :

ekorsembilan_0-1681853491473.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ekor-sembilan ,

I created a sample pbix file(see the attachment), please check if that is what you want. You can create a calculated column as below in 'Table 1' to get it:

Vehicle = 
CALCULATE (
    MAX ( 'Table 2'[Vechicle] ),
    FILTER ( 'Table 2', 'Table 2'[VehicleID] = 'Table 1'[VehicleID] )
)

vyiruanmsft_0-1682405680971.png

Or you can create a measure as below to get it:

Measure =
VAR _selvid =
    SELECTEDVALUE ( 'Table 1'[VehicleID] )
RETURN
    CALCULATE (
        MAX ( 'Table 2'[Vechicle] ),
        FILTER ( 'Table 2', 'Table 2'[VehicleID] = _selvid )
    )

vyiruanmsft_1-1682405854154.png

Best Regards

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @ekor-sembilan ,

I created a sample pbix file(see the attachment), please check if that is what you want. You can create a calculated column as below in 'Table 1' to get it:

Vehicle = 
CALCULATE (
    MAX ( 'Table 2'[Vechicle] ),
    FILTER ( 'Table 2', 'Table 2'[VehicleID] = 'Table 1'[VehicleID] )
)

vyiruanmsft_0-1682405680971.png

Or you can create a measure as below to get it:

Measure =
VAR _selvid =
    SELECTEDVALUE ( 'Table 1'[VehicleID] )
RETURN
    CALCULATE (
        MAX ( 'Table 2'[Vechicle] ),
        FILTER ( 'Table 2', 'Table 2'[VehicleID] = _selvid )
    )

vyiruanmsft_1-1682405854154.png

Best Regards

Greg_Deckler
Community Champion
Community Champion

@ekor-sembilan OK, so you can't use a measure if you want it as a calculated column in a table. Here is the calculated column form:

Column in Table 3= 
  VAR __UserID = [UserId]
  VAR __VehicalID = MAXX(FILTER('Table 1', [UserID] = __UserID), [Vehicle])
  VAR __Vehical = MAXX(FILTER('Table 2', [VehicalID] = __VehicalID), [Vehical])
RETURN
  __Vehical

This assumes no relationships. If you have relationships you can probably use RELATED.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hello Greg,

Thanks for your quick reply. 
But, it's strange that the value is not the same. Here is the capture 

ekorsembilan_0-1681856918648.png

Thanks

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.