Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I would like to filter the departure and arrival times of the cranes. I have a database with the times of the different cranes mixed together and with this code it calculates the intermediate time i.e. arrival time of the 1st crane - next departure time for the 1st crane.
The code sorts the filtered times by bridges but if I have a lot of lines this code does not work anymore because of the "earlier" function which is very greedy for the pc, how to simplify this code please?
Solved! Go to Solution.
@Anonymous , Sorry, Try like
CALCULATE(MIN('Bridge Hall 3 M'[DateHour_Origin]),FILTER('bridge Hall 3 M','bridge Hall 3 M'[Number_bridge]=EARLIER('bridge Hall 3 M'[Number_Pont])
&&'bridge Hall 3 M'[Date Rank] = EARLIER('bridge Hall 3 M'[Date Rank]) +1 ))-'bridge Hall 3 M'[Datehour_Arrival])
@Anonymous , Sorry, Try like
CALCULATE(MIN('Bridge Hall 3 M'[DateHour_Origin]),FILTER('bridge Hall 3 M','bridge Hall 3 M'[Number_bridge]=EARLIER('bridge Hall 3 M'[Number_Pont])
&&'bridge Hall 3 M'[Date Rank] = EARLIER('bridge Hall 3 M'[Date Rank]) +1 ))-'bridge Hall 3 M'[Datehour_Arrival])
It doesn't give me the desired values, isn't there a way to have a code similar to my original code by removing "earlier"?
I just passed but I don't get the right values...
An example of the application I need:
Deck 2 datetime departure: 20/07/22 01:06:23 dtatetime arrival: 20/07/22 01:07:23
Deck 3 datetime departure: 20/07/22 03:00:26 datetime arrival: 20/07/22 03:07:26
Deck 1 start time: 20/07/22 02:00:00 finish time: 20/07/22 02:04:05
Deck 2 datetime departure : 20/07/22 03:08:00 dtatetime arrival : 20/07/22 03:09:55
The code must take into account the bridge number, the departure time after 03:08:00 minus the arrival time before 01:07:23 = 2:00:37
@Anonymous , Create two columns
Date Rank = rankx(Filter('bridge Hall 3 M' , [Number_bridge] = EARLIER('bridge Hall 3 M'[Number_Pont]) ), 'bridge Hall 3 M'[DateHour_Origin],,asc, dense)
Col2 =
CALCULATE(MIN('Bridge Hall 3 M'[DateHour_Origin]),FILTER('bridge Hall 3 M','bridge Hall 3 M'[Number_bridge]=EARLIER('bridge Hall 3 M'[Number_Pont])
&&'bridge Hall 3 M'[Date Rank] = EARLIER('bridge Hall 3 M'[Date Rank] +1 )))-'bridge Hall 3 M'[Datehour_Arrival])
Hi @amitchandak,
I get an error message "the first argument of earlier is not a valid column reference in the previous row context." for EARLIER('bridge Hall 3 M'[Date Rank] +1
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
97 | |
95 | |
80 | |
77 | |
66 |
User | Count |
---|---|
130 | |
106 | |
105 | |
86 | |
72 |