Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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 3
Greg_Deckler
Super User
Super User

Try:

 

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

See attached.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
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? 

HotChilli
Super User
Super User

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] )
    )
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.