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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Urgent overall average by category

Hello guys!

 

I need to know how to calculate the overall average of categories grouped by IDs.

 

Description:

-Category A should return Points = 2 because there are 4 different IDs (8940,8930,8936 and 8939)

-Category B should return Points = 8 (3+5) because there are 2 different IDs (8285 and 8280)

-Category C should return Points = 9,5 (2,5+3+4) because there are 3 different IDs (8725,8745 and 8737)

 

Once the sums are calculated by categories, now I must sum all these values and divide by 3 (number of distinct categories).

 

Result = (2+8+9,5)/3 = 6,5 (I need this value)

 

PointsItem Idcategory
0,58940A
0,58930A
0,58936A
0,58939A
38285B
38285B
58280B
58280B
2,58725C
2,58725C
38745C
38745C
48737C
48737C
1 ACCEPTED SOLUTION
mwimberger
Resolver II
Resolver II

Hi @Anonymous 

 

Try this :

Create a summary table :

Summary Table =
SUMMARIZE (
    'Table',
    'Table'[category],
    'Table'[Item Id],
    "average of ID", AVERAGE ( 'Table'[Points] )
)

 

Then create a measure of the average of the sum of the averages:

Average of summary =
DIVIDE (
    SUM ( 'Summary Table'[average of ID] ),
    DISTINCTCOUNT ( 'Summary Table'[category] )
)

 

This will give you the result you're after:

result.jpg

View solution in original post

2 REPLIES 2
mwimberger
Resolver II
Resolver II

Hi @Anonymous 

 

Try this :

Create a summary table :

Summary Table =
SUMMARIZE (
    'Table',
    'Table'[category],
    'Table'[Item Id],
    "average of ID", AVERAGE ( 'Table'[Points] )
)

 

Then create a measure of the average of the sum of the averages:

Average of summary =
DIVIDE (
    SUM ( 'Summary Table'[average of ID] ),
    DISTINCTCOUNT ( 'Summary Table'[category] )
)

 

This will give you the result you're after:

result.jpg

Anonymous
Not applicable

Thanks a lot! It worked perfectly!!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.