Forum Discussion

RamaKrishna8989's avatar
3 years ago
Solved

averagea calculation

Hi Issue 1: I have 5 rows with data as "1" but in the visual only one "1" is displayed. Issue 2: Avga result is 0.00               Syndicate_Admin @aserpiva64    
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi RamaKrishna8989

     

    Issue 1:In the visual only one "1" is displayed.

    The table automatically filters duplicate values, so you need to put another column of non-duplicate values in the table, and “1” will be displayed

     

     

    Issue 2: Enter boolean values such it calculates as "0" and "1"

    You can enter the power query editor and input the following codes to the “Advance Editor”

     

    let
    
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSAeJYHQjLCM4yhrNM4CxTMMs/LxXIDinPB/NCgkJdgVw3R59gV6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"col 1" = _t, #"col 2" = _t]),
    
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"col 1", type text}, {"col 2", type text}}),
    
        #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Value.Is(Value.FromText([col 1]),type number) then 1 else 0),
    
        #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Custom", Int64.Type}}),
    
        #"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Custom", "Boolean"}}),
    
        #"Reordered Columns" = Table.ReorderColumns(#"Renamed Columns",{"col 1", "Boolean", "col 2"})
    
    in
    
        #"Reordered Columns"

     

    It will display a new table like the following picture, then apply the data to the desktop.

     

     

    If your Current Period does not refer to this, please clarify in a follow-up reply.

     

    Best Regards,

    Xinru Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.