cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ValentinBIA Regular Visitor
Regular Visitor

Date / Lookup Tables

Morning dear Power BI users!

 

I am working on the data for car rentals. The cars leave from a station and parks in a station.

In my main query, I have the StationFrom column, the StationTo, and the number of rentals.

 

StationFromStationToRentals
AA4
AB5
AC1
BA4
BB5
BC9
CA3
CB2
CC7

 

I also have a lookup table that gives me more information on the location of the station.

 

StationLatLongCity
A5505Hogwart
B50555The Shire
C1400469Whiterun

 

However, it does not seem like I can link both the StationFrom and StationTo columns to my Location table (to Station column).

 

Do you guys know if I can link one column of a Lookup Table to 2 different colums of my main query ? Or should I just copy paste my Lookup table and use two of them?

 

Thank you very much !

1 ACCEPTED SOLUTION

Accepted Solutions
JoHo_BI Member
Member

Re: Date / Lookup Tables

Hi Valentin,

 

Always happy to help a Skyrim fan!

 

You can create a relationship to both, but only one will be active. But then in your calculations you can use the USERELATIONSHIP function to reference the inactive relationship instead. For example:

 

No. Rentals = CALCULATE(SUM(Table[Rentals]), USERELATIONSHIP(LookupTable[Station], Table[StationFrom]))

 

Otherwise, there is a LOOKUPVALUE function that may be of use.

 

Hope that helps! 

View solution in original post

2 REPLIES 2
JoHo_BI Member
Member

Re: Date / Lookup Tables

Hi Valentin,

 

Always happy to help a Skyrim fan!

 

You can create a relationship to both, but only one will be active. But then in your calculations you can use the USERELATIONSHIP function to reference the inactive relationship instead. For example:

 

No. Rentals = CALCULATE(SUM(Table[Rentals]), USERELATIONSHIP(LookupTable[Station], Table[StationFrom]))

 

Otherwise, there is a LOOKUPVALUE function that may be of use.

 

Hope that helps! 

View solution in original post

ValentinBIA Regular Visitor
Regular Visitor

Re: Date / Lookup Tables

Hi JoHo,

 

Thank you very much, that is exactly what I was looking for !

 

(glad you noticed the Skyrim reference 🙂 )

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors