Forum Discussion
First repeated occurence
- 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])))
AllisonKennedy and amitchandak thanks a lot for your answers.
amitchandak unfortunately your solution gave me an "out of memory" error.
AllisonKennedy your solution game me this
The calculation looks prety much like what I was looking for. However, I don't undestand why if we look at the first trip, it finds 1 row for Mali in departures. It doesn't look right, since that line is departure_time_sk = 16481 and the one it finds (I guess) is 16561 which isn't <= to 16481.
What's going on?
I managed to solve this switching Arrival country and departure country in the first line of the filter.
Thanks!
- AllisonKennedy5 years agoCommunity ChampionThanks for the update setis
I will update my original post now so the solution looks more accurate. 🙂