Forum Discussion
CornelisV
1 year agoHelper IV
Transpose table with calculation
Dear all, I want to transpose the table: Time Phase 01:05 Start heating 05:50 End heating 06:00 Start Cooling 12:17 End cooling Into this form: Duration Phase ...
- 1 year ago
CornelisV This will calculate the number of minutes in a column. See attached PBIX below sig.
Column = VAR __Phase = [Phase] VAR __Current = [Date time] VAR __Type = SWITCH( TRUE(), __Phase = "End heating", "Start heating", __Phase = "End cooling", "Start Cooling" ) VAR __Result = SWITCH( __Phase, "Start heating", 0, "Start cooling", 0, VAR __DateTime = [Date time] VAR __Result = MAXX( FILTER( ALL( 'Table' ), [Date time] < __DateTime && [Phase] = __Type ), [Date time] ) RETURN __Current - __Result ) RETURN __Result * 60 * 24
Greg_Deckler
1 year agoCommunity Champion
CornelisV Are there more than just 1 instance of heating and cooling in the table? Do you want this in DAX or Power Query or do you not care?