Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
twowaysyellow
Frequent Visitor

Calculating Supported Trips Based on Area and Direction in Power BI

I have a table with information about trips, and whether a trip is supported or not based on whether it takes place within a certain area. A trip is supported either by the departing (starting) area, the arriving (end) area or not supported at all.

 

Not all areas are supporters and trips can take place in unsupported areas. A trip can only be supported by one area.

 

Trips can travel within the same are or between different areas.

Trips within the same area can be either

  1. supported or
  2. not supported

For trips that travel from one area to another there are several scenarios

  1. both from and to areas are supporters
  2. only from is supporter
  3. only to is supporter
  4. none are supporters

For 1 and 2 in different areas, it is always the from area that is considered the supporter. In scenario 3 the to area is considered supporter and for 4 obviously none are supporters.

 

I have a base table like this

trip_iddirectionarea_idfrom_supportedto_supported
1from110
1to201
2from300
2to101
3from110
3to300
4from300
4to400
5from110
5to101
6from300
6to300

 

I want to end up with a table like the one below. I already have the first 5 columns, but I'm missing the last one, which I cannot get to work. I hope someone can help.

 

area_idtrips_startingtrips_endingtrips_withintotal_tripstrips_supported
121144
2 1 10
321140
4 1 10

 

 

 

1 REPLY 1
whitch
Resolver I
Resolver I

In Power Query create a 'Trips' table by grouping your base table on Trip_id and area_id, and summing the [from_supported] and [to_supported] columns.  Add a [trip supported] column which is 0 if [from_supported] and [to_supported] are both 0, and is 1 otherwise.  Now group on area_id and sum [trip supported].

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.