DAX help request: Load Factor (sample inside)

efofecks

New Member
Joined
May 8, 2014
Messages
5
Hello all, I'm stumped with this problem.

The (simplified) data I have is as follows:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Flight[/TD]
[TD]Cabin[/TD]
[TD]Passengers[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Business[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Economy[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Economy[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Economy[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]

And I have a lookup table of capacity per flight:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Flight[/TD]
[TD]Cabin[/TD]
[TD]Capacity[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Business[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Economy[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Business[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Economy[/TD]
[TD]15[/TD]
[/TR]
</tbody>[/TABLE]

How do I calculate Load Factor (passengers / capacity) per cabin? Aiming to have a result similar to the one below. I get tripped up whenever I need to combine DistinctCount and calculate filters, and get stuck when capacity exists but no passengers do. (e.g. no Business Class travelers for flight B)

Output:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Flight[/TD]
[TD]Cabin[/TD]
[TD]Passengers[/TD]
[TD]Capacity[/TD]
[TD]Load Factor[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Business[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD]20%[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Economy[/TD]
[TD]5[/TD]
[TD]10[/TD]
[TD]50%[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Total[/TD]
[TD]6[/TD]
[TD]15[/TD]
[TD]40%[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Business[/TD]
[TD]0[/TD]
[TD]5[/TD]
[TD]0%[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Economy[/TD]
[TD]3[/TD]
[TD]15[/TD]
[TD]20%[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Total[/TD]
[TD]3[/TD]
[TD]20[/TD]
[TD]15%[/TD]
[/TR]
</tbody>[/TABLE]


Any help would be much appreciated.
 
Last edited:

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Excel Workbook
ABCDE
1FlightCabinPassengers
2ABusiness1
3AEconomy2
4AEconomy3
5BEconomy4
6
7
8FlightCabinCapacity
9ABusiness5
10AEconomy10
11BBusiness5
12BEconomy15
13
14FlightCabinPassengersCapacityLoad Factor
15ABusiness1520%
16Economy51050%
17Total61540%
18
19BBusiness050%
20Economy41527%
21Total42020%
Sheet1
 
Upvote 0
Hi skywriter,

Thank you for your response - However, I was hoping for a DAX calculation (this is part of a larger dashboard, and sumifs won't work - I'm pulling from a database with about 15 million rows). Would you know any calculated measure that can handle the required pivot table?

Thanks,
 
Upvote 0
So... I wanted to relate these 2 tables. I'm not positive that is required, but as an initial attempt it made sense to me. To do so, I made a calculated column on each table called "Flight-Cabin" =[Flight]&"-"&[Cabin].
(In Power Pivot you can't create a relationship with multiple columns, so I made this dude... then related the tables).

Then wrote these measures:
TotalPassengerCapacity:=sum(FlightCapacity[Capacity])
TotalActualPassengers:=if (COUNTROWS(FlightData) = 0, 0, sum(FlightData[Passengers]))
LoadFactor:=DIVIDE([TotalActualPassengers],[TotalPassengerCapacity])

Lemme know what you think,
Scott
 
Upvote 0
Thanks, scottsen. I'm not in the office right now but I think the key is your TotalActualPassengers line. The actual model is slightly more complicated than this but I'll certainly try this tomorrow and get back whether it works or not!
 
Upvote 0

Forum statistics

Threads
1,223,996
Messages
6,175,857
Members
452,676
Latest member
woodyp

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top