Forum Discussion

Grace1's avatar
Grace1
Icon for Helper II rankHelper II
7 years ago

How to obtain class description

Hi

 

I am new to Power BI.  I like to obtain Class Description in Sales Table from Booking Class using Carrier and Class as relationship.

Appreciate advice. Thanks.

 

Sales Table           
Inv. No.Inv. DateClassCarrierTotal  Air FareTaxesService  Hotel & VisaCanx & Total Class 
    Ticket   Fee Package  Others Sales Description
             
123 03/01/18Y/ESQ12,563.00250.4060.00   2,873.40Econ/Econ
124 04/01/18QTG1352.00101.8030.00   483.80Economy
125 05/01/18DBA17,477.00997.9060.00   8,534.90Business
126 05/01/18QTG1352.00101.9030.00   483.90Economy
127 23/01/18DNH12,320.0059.2060.00   2,439.20Business
128 23/01/18DNH11,740.0059.2050.00   1,849.20Business
129 23/01/18DNH12,320.0059.2060.00   2,439.20Business
130 24/01/18Y/ESQ11,545.00146.8050.00   1,741.80Econ/Econ
131 24/01/18E/YSQ11,545.00146.8050.00  10.001,751.80Econ/Econ
132 29/01/18ESQ1672.0048.8040.00   760.80Economy
133 07/02/18QTG1332.00102.0030.00   464.00Economy
134 14/02/18H/KKE1525.00347.2040.00   912.20Econ/Econ
135 14/02/18J/ESQ12,819.0066.0080.00   2,965.00Biz/Econ
136 01/03/18E/BSQ1691.0067.9040.00   798.90Econ/Biz
137 09/03/18W/LJL11,395.00172.1050.00   1,617.10Prem Econ/Econ
Booking Class code            
CarrierClassRemarks           
JLLEconomy          
JLWPremium Economy          
KEHEconomy          
KEKEconomy          
NHDBusiness          
SQBEconomy          
SQCBusiness          
SQDBusiness          
SQEEconomy          
SQJBusiness          
SQNEconomy          
SQQEconomy          
SQSPremium Economy          
SQTEconomy          
SQYEconomy          
SQZBusiness          
TGQEconomy          

2 Replies

  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    Icon for Community Support rankCommunity Support

    Hi Grace1,

     

    From your post, the Class Description column should exist in Sales Table. Would you please clarify the words "I like to obtain Class Description in Sales Table from Booking Class"? 

     

    In Power BI desktop, only one active relationship is supported between two tables. You can create a relationship between Carrier columns in these two tables with many to many relationship.  For detail information, I would suggest you go through this document: https://docs.microsoft.com/en-us/power-bi/desktop-many-to-many-relationships

     

     

     

    Best Regards,
    Qiuyun Yu 

  • Grace1 here is the solution, add column in each table

     

    New column in BookingClass Table

    CarrierClassKey = BookingClass[Carrier] && BookingGlass[Class]
    New column in Sales Table CarrierClassKey = Sales[Carrier] && Sales[Class]

    Once you have above columns added, set relation between these two table on this new column. After relationship, you add another new column in sales table to get class description

     

    Class Description = RELATED( BookingClass[Remarks])