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.
Hi,
I would like to calculate the date/time difference between rows that have the same [ASSET_ID_UNIT] and [C_ASSET_TRIP_ID].
From those lines I would like to take the [CC FLOW_DATE_TIME] where it is 110 - [CC FLOW_DATE_TIME] where it is 80
Like this:
Left is what I have. Right is what I would like to have:
The model:
[ASSET_ID_UNIT] and [C_ASSET_TRIP_ID] come from table [FLOW_LINE_DETAIL]
[CC FLOW_DATE_TIME] and [FLOW_TYPE_ID] come from table [FLOW]
Does anyone have a clue how to do this?
I have been fiddling around with things like
GRAI 80 DATE := FIRSTNONBLANK(RELATEDTABLE(FLOW),FLOW[FLOW_TYPE_ID]=110)
I am not sure if related/relatedtable even works with a measure.
But nothing works...
Solved! Go to Solution.
Hi @Serge_van_Dun,
Could you try firstly changing the cross filter direction to Both for all the relationships in your model, then use the formulas below to see if it works in your scenario?
GRAI 80 DATE := CALCULATE ( FIRSTNONBLANK ( FLOW[CC FLOW_DATE_TIME], 1 ), FILTER ( FLOW, FLOW[FLOW_TYPE_ID] = 80 ) )
GRAI 110 DATE := CALCULATE ( FIRSTNONBLANK ( FLOW[CC FLOW_DATE_TIME], 1 ), FILTER ( FLOW, FLOW[FLOW_TYPE_ID] = 110 ) )
Time Diff := IF ( [GRAI 110 DATE] > [GRAI 80 DATE], DATEDIFF ( [GRAI 80 DATE], [GRAI 110 DATE], MINUTE ) )
Regards
Hi @Serge_van_Dun,
Could you try firstly changing the cross filter direction to Both for all the relationships in your model, then use the formulas below to see if it works in your scenario?
GRAI 80 DATE := CALCULATE ( FIRSTNONBLANK ( FLOW[CC FLOW_DATE_TIME], 1 ), FILTER ( FLOW, FLOW[FLOW_TYPE_ID] = 80 ) )
GRAI 110 DATE := CALCULATE ( FIRSTNONBLANK ( FLOW[CC FLOW_DATE_TIME], 1 ), FILTER ( FLOW, FLOW[FLOW_TYPE_ID] = 110 ) )
Time Diff := IF ( [GRAI 110 DATE] > [GRAI 80 DATE], DATEDIFF ( [GRAI 80 DATE], [GRAI 110 DATE], MINUTE ) )
Regards
Hi v-ljerr-msft,
That is exactly what I needed!
Thanks a lot!
Kind regards,
Serge
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 |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |