Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Average based on criteria on same column

Hi I have a data that looks like this

Names#No% Completion
A197.50%
D488.89%
E573.38%
F5100.00%
G6100.00%
N1382.08%
O1383.75%
P1486.67%
Q1484.50%


What i want to achieve is basically  = Completion / Count of No that has the same value. Refer to Average % Completion column below:

Names#No% CompletionAverage % Completion
A197.50%97.00%
D488.89%88.89%
E573.38%86.69%
F5100.00%86.69%
G6100.00%100.00%
N1382.08%82.92%
O1383.75%82.92%
P1486.67%85.59%
Q1484.50%85.59%

 

% Completion is a measure = Average(Completion) based on Names.
So basically now what is want is Average of ( Average(completion) based on names) based on #No

And my final table will be WITHOUT #No Column

Names% CompletionAverage % Completion
A97.50%97.00%
D88.89%88.89%
E73.38%86.69%
F100.00%86.69%
G100.00%100.00%
N82.08%82.92%
O83.75%82.92%
P86.67%85.59%
Q84.50%85.59%

I have tried  some of calculation but most of it doesnt work after i get rid of #No column


Thanks.

3 Replies

  • HotChilli's avatar
    HotChilli
    Icon for Community Champion rankCommunity Champion

    Removing '#No' from your visualisations changes context so I think you need something like this

    Measure  = 
    CALCULATE (
        AVERAGE(Table[% Completion]), 
        FILTER (
            ALL ( Table ), 
            Table[#No] = MAX ( Table[#No] )
        )
    )
  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Try:

     

    Measure = 
    VAR __no = MAX([#No])
    VAR __table = FILTER(ALL(Table1),[#No] = __no)
    RETURN
    AVERAGEX(__table,[% Completion])

    See attached.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Greg_Deckler  & HotChilli ,

      Weirdly i used both of your formula on my dummy table it works, but when i used it on my real data it doesnt work. FYI i filter by year (single select) is it somehow one of the reason why it doesnt work?