Forum Discussion
CornelisV
Helper IV
1 year agoCreate new summarized table and skip blanks
Dear all, I have a table with 3 columns: TS Phase 1 Phase2 01:00 02:00 Start 03:00 04:00 05:00 06:00 End 07:00 End 08:00 End ...
- Anonymous1 year ago
Hi CornelisV ,
In your example, if you only want to keep the first record where the value of the phase column is "end", please try this
Table 2 = var _startTime =MAXX( FILTER( 'Table',[Phase 1]="Start"),[TS]) var _endTime = CALCULATE(MIN('Table'[TS]), FILTER('Table',[Phase2]="End"&&[TS]>=_startTime)) RETURN SELECTCOLUMNS( { (_startTime, "Start"), (_endTime, "End") }, "Ts", [Value1], "Phase", [Value2] )Best Regards,
Wearsky
- 1 year ago
Hi,
This M code works
let Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content], #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"TS"}, "Attribute", "Value"), #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"}), #"Removed Duplicates" = Table.Distinct(#"Removed Columns", {"Value"}), #"Changed Type" = Table.TransformColumnTypes(#"Removed Duplicates",{{"TS", type time}}) in #"Changed Type"Hope this helps.
Ashish_Mathur
Super User
1 year agoHi,
This M code works
let
Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"TS"}, "Attribute", "Value"),
#"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"}),
#"Removed Duplicates" = Table.Distinct(#"Removed Columns", {"Value"}),
#"Changed Type" = Table.TransformColumnTypes(#"Removed Duplicates",{{"TS", type time}})
in
#"Changed Type"
Hope this helps.
- CornelisV1 year ago
Helper IV
Hello Ashish_Mathur ,
Thank you for your solution, the UnpivotOtherColums is doing the job and subsequently the distinct step.
Best regards,
Cornelis
- Ashish_Mathur1 year ago
Super User
You are welcome.