Forum Discussion

smann's avatar
smann
Helper I
8 years ago

Descriptive statistics table

Would it be possible to generate something like this in Power BI? Currently, I can calculate the values individually for the variables, but I would like to have one single table if possible.

 

  Categorical variablesContinuous variables   
  Sample Size (N)% (n/N)MeanMedianSDRange
Age 102-25223.529-27
Gender:
Male 10265.7 (67/102)----
Female 10234.3 (35/102)----

 

4 Replies

    • smann's avatar
      smann
      Helper I

      Source data:

      let
          Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcszLS1XSUXJLzU3MATGMTJVidaKV3IoS84A8X6igOVjQKxFNrSFEOD8VSakxVCwDWb8JWNA7sQRVvyVY2DexKD2xKLUERcoCJlWJImwGFg7Jz0UyHOiKWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, Gender = _t, Age = _t]),
          #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Gender", type text}, {"Age", Int64.Type}})
      in
          #"Changed Type"

       

      Expected result:

        

      Categorical variables

      Continuous variables

         
       

      Sample Size (N)

      % (n/N)

      Mean

      Median

      SD

      IQR

      Age

      8

       

      25.4

      25.5

      2.7

      3.5

      Gender

      7

           

      Male

       

      42.9% (3/7)

          

      Female

       

      57.1% (4/7)