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

Measure for group average

I have a measure for calculationg average of number of days since last input. 

 

I want to have another measure showing group average after filtering specific project to compare project with the group. I used function ALL to ignore the project filter but it is diving me average for all groups instead of the one i want. 

 

Groupaverage daysdays group average
abc1010
def2020
ghi3030
 2020

 

measure = calculate([average], ALL(project[id]))

 

when selecting one project from group abc, I need the other measure to be showing 10 as group average for abc but its showing average for all groups - 20

 

i wanted to try groupby but as my average is calculated measure i didnt think it would be useful. 

 

how to show second average for group ? when i select one project i want to see the average for the group the product is in.

 

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Try this:

average = AVERAGE ( 'Table'[Days average] )
divisional average = 
AVERAGEX (
    'Table',
    CALCULATE (
        AVERAGE ( 'Table'[Days average] ),
        ALLEXCEPT ( 'Table', 'Table'[Group] )
    )
)

average.PNG


Best Regards
Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Try this:

average = AVERAGE ( 'Table'[Days average] )
divisional average = 
AVERAGEX (
    'Table',
    CALCULATE (
        AVERAGE ( 'Table'[Days average] ),
        ALLEXCEPT ( 'Table', 'Table'[Group] )
    )
)

average.PNG


Best Regards
Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

superb !! thank you so much for this ! 

 

would this work in a table as well ? I need a column in a table where for each row i want to see this group average (no not only when i select specific group).

Anonymous
Not applicable

I created this sample of data : 

 

ProductGroupDays average
aabc50
babc60
cabc80
dabc100
eabc500
fabc100
habc50
iabc60
jdef70
kdef100
ldef100
mdef120
ndef140
odef150
pdef160

 

I want to have a measure showing average for product(s) and another one showing average for division. (i will have 2 cards next to each other for comparison)

 

e.g. when i select project a it gives me : average 50, divisional average 125

 

@Anonymous  you can achieve this by following measures

 

Average by group = CALCULATE(AVERAGE('Table 2'[Days average]),ALL('Table 2'[Product]))

Average by Product = CALCULATE(AVERAGE('Table 2'[Days average]),ALL('Table 2'[Group]))
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Icey
Community Support
Community Support

Hi @Anonymous ,

You can use ALLSELECTED. And it would be great if you could provide some sample data.

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

lc_finance
Solution Sage
Solution Sage

Hi @Anonymous ,

 

could you include a sample version of your Power BI file?

You can share it via DropBox, One Drive, Drive or any similar tool.

 

Regards

 

LC

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.