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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Nntsilvis
New Member

Create an Average calculation grouping by two different fields

I need to create the calculation for the avg score grouping by subtheme per each client(case ID).

I created a expected output based on some inputs values:

 

Screenshot 2024-11-05 174455.jpg

As you can see, first all i need to sum the score per subtheme, then divide each client score for the subtheme which its belongs. 

 

I have tried several formulas, such as:

 

Nothing works as expected: sometimes the values returned are the same as the score field for each client/caseid, or either it just calculate the sum of the score/count(total clients), what is not true, sice the nominator will variate depending of the score oh that or other specific client per suntheme each belongs.
 
If someone know how to solve it. i would appreciate a lot. 🙂
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Nntsilvis ,

 

Please use the following measures to meet your requirements:

SumPerSubtheme = CALCULATE(SUM('Table'[Score]),ALLEXCEPT('Table','Table'[Subtheme]))
AveragePerCaseIDBySum = DIVIDE(MAX('Table'[Score]),[SumPerSubtheme],0)

Result for your reference:

vyajiewanmsft_0-1731050058388.png

Best regards,

Joyce

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Nntsilvis ,

 

Please use the following measures to meet your requirements:

SumPerSubtheme = CALCULATE(SUM('Table'[Score]),ALLEXCEPT('Table','Table'[Subtheme]))
AveragePerCaseIDBySum = DIVIDE(MAX('Table'[Score]),[SumPerSubtheme],0)

Result for your reference:

vyajiewanmsft_0-1731050058388.png

Best regards,

Joyce

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

 

Nntsilvis
New Member

Follow the attampts i had tried:
Score Ratio1 = VAR Nominator = CALCULATE( SUM('fact_assessment'[Sub-theme score]), ALLEXCEPT(dim_client, dim_client[GCID]) ) VAR Denominator = CALCULATE( SUM('fact_assessment'[Sub-theme score]), ALLEXCEPT(dim_subtheme, dim_subtheme[Subtheme_id]) ) RETURN DIVIDE(Nominator, Denominator, 0)

Score Ratio2 = CALCULATE ( AVERAGE ( fact_assessment[Subtheme score] ), ALLEXCEPT ( fact_assessment, fact_assessment[Subtheme_id], fact_assessment[Case ID]) )

Score Ratio3 = AVERAGEX( SUMMARIZE( 'fact_assessment_scores', 'fact_assessment_scores'[Case ID], 'fact_assessment_scores'[Subtheme_id], "AvgScore", AVERAGEX( FILTER( 'fact_assessment_scores', NOT ISBLANK('fact_assessment'[Subtheme score]) ), 'fact_assessment_scores'[Subtheme score] ) ), [AvgScore] )

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.