Forum Discussion

DHB's avatar
DHB
Helper V
9 years ago
Solved

histogram problem

I'm trying to create a histogram using this data.  I'm using Activity Score as the Value and want to show the average of Average Test Score in each bucket.  What I'm getting though is Frequency of Activity Score in each bucket.  So for the first bucket (Activity Scores 4.8-13.86) I get a frequency of 4 (4.8 twice, 9.7, 12.6 and 13.5).  I would like an average of .8333, .8, .7666, .775 and .6222.   Any ideas what I'm doing wrong?  Thank you in advance.

 

ACTIVITY_SCOREAverage of Test Score
4.80.833333333
4.80.8
9.70.766666667
12.60.775
13.50.622222222
15.50.95
15.50.766666667
16.40.633333333
17.40.822222222
17.40.766666667
19.30.922222222
19.30.625
19.30.444444444
21.30.777777778
22.20.905555556
22.20.455555556
23.20.8
23.20.733333333
23.20.688888889
23.20.45
23.20.811111111
24.20.9
24.20.641666667
25.10.858333333
25.10.798333333
25.10.858333333
25.10.855555556
25.10.788888889
  • DHB

     

    Accordin to your description, you want to create average for each bucket of your table. Right?

     

    In this scenario, you should create a bucket table like:

     

    Then create a Bucket Column in your source table.

    Bucket = CALCULATE(VALUES(Table1[BucketGroup]),FILTER(Table1,Table2[Score]>Table1[MinScore] && Table2[Score]<=Table1[MaxScore]))

    Then you can just include this column and Activity Score column into same table. Change the aggregation type into "Average".

    Regards,

  • DHB's avatar
    DHB
    9 years ago

    That looks perfect.  I'll give it a try.  Thank you.

3 Replies

  • v-sihou-msft's avatar
    v-sihou-msft
    Microsoft Employee

    DHB

     

    Accordin to your description, you want to create average for each bucket of your table. Right?

     

    In this scenario, you should create a bucket table like:

     

    Then create a Bucket Column in your source table.

    Bucket = CALCULATE(VALUES(Table1[BucketGroup]),FILTER(Table1,Table2[Score]>Table1[MinScore] && Table2[Score]<=Table1[MaxScore]))

    Then you can just include this column and Activity Score column into same table. Change the aggregation type into "Average".

    Regards,

    • DHB's avatar
      DHB
      Helper V

      That looks perfect.  I'll give it a try.  Thank you.

      • DHB's avatar
        DHB
        Helper V

        I've used the information that you gave and been able to do exactly what I was trying to do.  Thank you so much.