Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Need help in calculating standard deviation using custom column

Dear All,   I would like to calcuate standard devation on below data using Custom column, please help I'm new to Power BI tool. Data looks like below   Source Data: Site Code DAY_DATE DAYS...
  • v-yulgu-msft's avatar
    8 years ago

    Hi Anonymous,

     

    Please try below Power Query.

    let
        Source = Excel.Workbook(File.Contents("C:\Users\xxxx\Desktop\Sample Data (Autosaved) (Autosaved).xlsx"), null, true),
        data_Sheet = Source{[Item="data",Kind="Sheet"]}[Data],
        #"Promoted Headers" = Table.PromoteHeaders(data_Sheet, [PromoteAllScalars=true]),
        #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Site", type text}, {"Code", type text}, {"DAY_DATE", type datetime}, {"DAYS", Int64.Type}}),
        #"Grouped Rows" = Table.Group(#"Changed Type", {"Site", "Code"}, {{"standard deviation", each List.StandardDeviation([DAYS]), type number}})
    in
        #"Grouped Rows"

     

    Best regards,

    Yuliana Gu