Forum Discussion

MSB_gpc's avatar
MSB_gpc
Frequent Visitor
8 years ago

Map with Multiple Relationships

Hello everyone,

 

I am a recent user of Power BI and I need some help with this case. 

 

I am working with two tables.

First one contains three columns: Origin, Destination, Issue (can have repeated values). The origin column has n different possible values while destination column has m different values (m>n and includes all origin values).

Second one contains three columns: Location, Latitude and Longitude (it has unique values).

 

I want to create two maps that show the number of issues by origin and destination respectively. It is easy to create one map by adding a relationship between the Location column of the second table and the Destination column of the first table.

The problem comes when creating the second map in the same report as the relationship between Origin and Location must be inactive.

 

Is there any solution?

 

I appreciate any help!

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Let the relationship between Origin and Location be inactive (that will be in the form of dotted lines) ... you can easily plot the map between Destination and Location as the reltionship between them is active.

     

    You can write a measure to make the particular relationship(Origin and Location) active by using USERRELATIONSHIP.

     

    Origin and Location:= CALCULATE(VALUES(Tabel1[Origin]),USERRELATIONSHIP(Tabel1[Origin],Table2[Location]))...

     

    This will make the inactive relationship active for this particular measure only...

    Give this a try...

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    There's possibly a more elegant solution but a simple solution would be to add two calculated columns in the first table for Origin Longitude and Origin Latitude and then use those in your second map.

     

    Calc would be something like

     

    Calculate( Values( Tabe2[Longitude]), Filter(Table2, Table2[Location] = Table1[Origin]))

    Calculate( Values( Tabe2[Latitude]), Filter(Table2, Table2[Location] = Table1[Origin]))

     

    Or for consistency add 4 columns, for origin long lat and destination long lat.

     

    Hope this helps,

     

    Will

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Microsoft Employee

    Hi MSB_gpc,

     

    Could you please mark the proper answer as solution or share the solution if it's convenient for you? That will be a big help to the others.

     

    Best Regards!
    Dale