Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

GroupBy Function Date Data Type Columns Change To Text Data Type

Whenever I use the "GroupBy" function on a non Date data type column and breakout the columns, any Date data type columns within that query change to Text data type 😬😠😮 I am then having to change...
  • v-jingzhang's avatar
    5 years ago

    Hi Anonymous 

     

    Do you mean group by on a column then expand the table column to show other columns? Based on my test, this will not change column data types. You can paste below codes to a blank query to see my result.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WciwtLsnMU9JRcgRiM30jfSMDI0Mg00gpVgdD1hiHrBNY1gSvrClMFizpkpiTk1gMlzSESRqgyqI7yhSbtDEuaWc0Z5lis9oUWToWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Region = _t, Type = _t, Date = _t, Value = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Region", type text}, {"Date", type date}, {"Value", Int64.Type}, {"Type", type text}}),
        #"Grouped Rows" = Table.Group(#"Changed Type", {"Region", "Type"}, {{"All", each _, type table [Region=nullable text, Type=nullable text, Date=nullable date, Value=nullable number]}}),
        #"Expanded All" = Table.ExpandTableColumn(#"Grouped Rows", "All", {"Date", "Value"}, {"Date", "Value"})
    in
        #"Expanded All"

     

    If I don't understand the issue correctly, can you share your codes or screenshots to help me understand it better? I'm a little confused about the description "breakout the columns"...😬

     

    Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as the solution to help other members find it.