Forum Discussion

sebastiangaga's avatar
sebastiangaga
New Member
6 years ago

Passenger distribution on a route, range intersection

Hi all,

 

I have a table with train tickets like this:

 

ticketIddepartureNamedepartureDistancearrivalNamearrivalDistance
556822Paris0Rome1400
558874Paris0Lion700
855462Lion500Milan900
547798Milan900Rome1400
900015Lion500Milan900
125569Paris0Milan900

 

The route is one directional (for simplicity) and the station distances are related to route's start (here Paris).

I need to compute a table that shows how many passenger are on each segment:

segmentStartsegmentEndpassengers
ParisLion3
LionMilan4
MilanRome2

 

With SQL Server I generated all the possible segments for a route and then I counted tickets besed on ticket and segment range intersection.

 

Can I do this with DAX or just import the View (which might get quite large for Dual or Import mode)?