Forum Discussion

CAWizz's avatar
CAWizz
Regular Visitor
3 years ago

Weekly Average

Hello, 

 

Any help will be extremely appreciate!

 

I have the following dataset made of a date column, customerID and group_class colomn with categorical datapoints for classifcation as seen below

app_Datecustomergroup_class
20230222record100_0to25999
20230228record200_0to25999
20230207record300_0to25999
20230209record402_30000to34999
20230220record501_26000to29999
20230201record600_0to25999
20230207record700_0to25999
20230204record801_26000to29999
20230226record901_26000to29999
20230208record1003_35000to39999
20230210record1103_35000to39999
20230207record1204_40000to49999
20230203record1301_26000to29999
20230228record1401_26000to29999
20230204record1500_0to25999
20230201record1600_0to25999

 

using the matrix visual, I created a daily distribution view showed as % of row total

To that, I would like to add another column with a calculated field displaying the average of the % for each group as seen below 

Weekly view01/01/202308/01/202315/01/202322/01/202329/01/2023Average of daily %
00_0to14998%4%   6%
01_1500to174912%14%14%14%16%14%
02_1750to199910%10%10%10%11%10%
03_2000to299939%41%43%44%43%42%
04_3000to499924%24%27%25%24%25%
05_5000to99997%6%7%7%6%7%

2 Replies

  • v-jingzhang's avatar
    v-jingzhang
    Community Support

    Hi CAWizz 

     

    I guess that your current value field showed as % of row total is based on the count of customerID, right? If so, you can create two measures similar to below, and add only the second measure to the matrix visual. 

    Measure = DIVIDE(COUNT('Table (2)'[customer]),CALCULATE(COUNT('Table (2)'[customer]),ALLSELECTED('Table (2)'[category])))
    Measure 2 = IF(ISFILTERED('Table (2)'[date]),[Measure],AVERAGEX(VALUES('Table (2)'[date]),[Measure]))

    Then in the formatting pane, go to Column subtotals and change the Subtotal label to "Average of daily %". 

    You will get the following matrix finally. 

     

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

  • CAWizz's avatar
    CAWizz
    Regular Visitor

    Hello, thank you for looking into this! I used the logic you kindly built for me to calclulate the weekly average and weekly standard deviation (population) however when comparing the PBI mesure outputs to the ones calculated in excel using the same dataset, i end up with some discrepency. I will get back to you as soon as this is fixed one my end! thank you