Forum Discussion

setis's avatar
setis
Post Partisan
5 years ago
Solved

First repeated occurence

Dear all,    I'm working with the following travel table:   As you can see, every travel has a unique pnrlocatorkey. Travels are usually return trips, as the 3 showed above.  What I'm tryi...
  • AllisonKennedy's avatar
    5 years ago

    Looks like the Travel_legs.firstleg and Travel_legs.lastleg will get you partly there.

    Based on your suggestion, if you just want to see if the Departure and Arrival cities already exist earlier in the table, you could try:
    UPDATED: Based on original poster's comments to reflect correct order of arrival and departure country. 


    TripReturn = COUNTROWS(FILTER(ALL(Travel), Travel[Departure Country] = EARLIER(Travel[Arrival Country]) && Travel[pnrlocatorkey] = EARLIER(Travel[pnrlocatorkey]) && Travel[Departure date] <= EARLIER(Travel[Departure date])))