# The bag way Probably less efficient ```kusto CommonSecurityLog | take 20 // pack each row into a bag | extend values = pack_all() // let the column removeProperties = the value of the mv-apply | mv-apply removeProperties = values on ( // with the array expansion values[1] contains the values of the packed bag and values[0] is the key // this is somewhat equivelent to a foreach or for loop mv-expand kind = array values // if the value is not empty make a set with the key else skip | where isempty(values[1]) | summarize propsToRemove = make_set(values[0]) ) // remove the empty columns from the packed values col | extend brk = bag_remove_keys(values, propsToRemove) // project only the new bag | project brk // expand the bag | evaluate bag_unpack(brk) ``` # The pivot way ```kusto CommonSecurityLog | take 20 // "Unpivot the columns" | evaluate narrow() // Remove values that are empty | where isnotempty(Value) and Value != '##(null)' // re-pivot the data | evaluate pivot(Column, take_any(Value), Row ) ```