Forum Discussion
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. Date | Class | Carrier | Total | Air Fare | Taxes | Service | Hotel & | Visa | Canx & | Total | Class |
| Ticket | Fee | Package | Others | Sales | Description | |||||||
| 123 | 03/01/18 | Y/E | SQ | 1 | 2,563.00 | 250.40 | 60.00 | 2,873.40 | Econ/Econ | |||
| 124 | 04/01/18 | Q | TG | 1 | 352.00 | 101.80 | 30.00 | 483.80 | Economy | |||
| 125 | 05/01/18 | D | BA | 1 | 7,477.00 | 997.90 | 60.00 | 8,534.90 | Business | |||
| 126 | 05/01/18 | Q | TG | 1 | 352.00 | 101.90 | 30.00 | 483.90 | Economy | |||
| 127 | 23/01/18 | D | NH | 1 | 2,320.00 | 59.20 | 60.00 | 2,439.20 | Business | |||
| 128 | 23/01/18 | D | NH | 1 | 1,740.00 | 59.20 | 50.00 | 1,849.20 | Business | |||
| 129 | 23/01/18 | D | NH | 1 | 2,320.00 | 59.20 | 60.00 | 2,439.20 | Business | |||
| 130 | 24/01/18 | Y/E | SQ | 1 | 1,545.00 | 146.80 | 50.00 | 1,741.80 | Econ/Econ | |||
| 131 | 24/01/18 | E/Y | SQ | 1 | 1,545.00 | 146.80 | 50.00 | 10.00 | 1,751.80 | Econ/Econ | ||
| 132 | 29/01/18 | E | SQ | 1 | 672.00 | 48.80 | 40.00 | 760.80 | Economy | |||
| 133 | 07/02/18 | Q | TG | 1 | 332.00 | 102.00 | 30.00 | 464.00 | Economy | |||
| 134 | 14/02/18 | H/K | KE | 1 | 525.00 | 347.20 | 40.00 | 912.20 | Econ/Econ | |||
| 135 | 14/02/18 | J/E | SQ | 1 | 2,819.00 | 66.00 | 80.00 | 2,965.00 | Biz/Econ | |||
| 136 | 01/03/18 | E/B | SQ | 1 | 691.00 | 67.90 | 40.00 | 798.90 | Econ/Biz | |||
| 137 | 09/03/18 | W/L | JL | 1 | 1,395.00 | 172.10 | 50.00 | 1,617.10 | Prem Econ/Econ | |||
| Booking Class code | ||||||||||||
| Carrier | Class | Remarks | ||||||||||
| JL | L | Economy | ||||||||||
| JL | W | Premium Economy | ||||||||||
| KE | H | Economy | ||||||||||
| KE | K | Economy | ||||||||||
| NH | D | Business | ||||||||||
| SQ | B | Economy | ||||||||||
| SQ | C | Business | ||||||||||
| SQ | D | Business | ||||||||||
| SQ | E | Economy | ||||||||||
| SQ | J | Business | ||||||||||
| SQ | N | Economy | ||||||||||
| SQ | Q | Economy | ||||||||||
| SQ | S | Premium Economy | ||||||||||
| SQ | T | Economy | ||||||||||
| SQ | Y | Economy | ||||||||||
| SQ | Z | Business | ||||||||||
| TG | Q | Economy |
2 Replies
- v-qiuyu-msft
Community 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 - parry2k
Super User
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])