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.
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: