Forum Discussion

carlosz22's avatar
carlosz22
Regular Visitor
8 years ago

Measure from two tables

 

Hi guys,

 

I'm new to Power BI and I'd love your help about the following calculation.

 

There are two tables: Fee and Passenger.

 

Table 1: Fee

AirlineDateSales ChannelFee Count
AA03/05/2018A5
AA04/05/2018A6
AA05/05/2018B23
AA06/05/2018A2
AA06/05/2018B12
AA06/05/2018C5
BB05/05/2018A8
BB05/05/2018C14
BB07/05/2018A9

 

 

Table 2: Passenger

AirlineDatePassenger Count
AA03/05/2018102
AA04/05/2018105
AA05/05/2018200
AA06/05/2018210
BB05/05/2018168
BB05/05/2018195
BB07/05/2018144

 

 

Fee Table has a column called Sales Channel and Pax Table does not.

 

How could I connect both tables to get the Buy rate SUM(Fee Count) / SUM(Passenger Count)?

 

I really appreciate your help.

3 Replies

  • alexei7's avatar
    alexei7
    Continued Contributor

    Hi carlosz22,

     

    If you're looking to split this by Airline and/or date, it'd make sense to have an "Airline" and/or "Date" table with the values that you need and then join the table to your existing Fee and Passenger tables.

  • v-piga-msft's avatar
    v-piga-msft
    Resident Rockstar

    Hi  carlosz22,

     

    We cannot create the relationship between the two tables directly because of the many to many raltionship which is not supported in Power BI.

     

    So we could create the third table that has distinct value of Airline from both tables.

     

    Table = DISTINCT(UNION(DISTINCT(Passenger[Airline]), DISTINCT(Fee[Airline])))

    Then you could create the measure to get the Buy rate .

     

    Measure 2 = DIVIDE(SUM('Fee'[Fee Count]),SUM('Passenger'[Passenger Count]))

    Hope this can help you!

     

    Best Regards,

    Cherry

  • v-piga-msft's avatar
    v-piga-msft
    Resident Rockstar

    Hi carlosz22,

     

    Have you solved your problem?

     

    If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

     

    If you still need help, please let me know.

     

    Best Regards,

    Cherry