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
afaherty
Helper V
Helper V

Simple DAX Assistance - Unpivoting done, averages not coming out correctly

Hello,

Here is some dummy data to represent my problem. Each student can be in more than 1 College Major, so the data is unpivoted so that each student has data for each of their majors.

I need to get the average of the tests but also the subtests. I have drawn a silly little depiction of how I am setting up the dashboard, including slicers. I was getting the correct averages UNTIL I unpivoted the data and now it's duplicating the averages.

 

Student IDTestSubtestScoreCollege Major
1MathDecimals3Middle School Math
1MathFractions5Middle School Math
1MathEquations3Middle School Math
1MathDecimals3Middle School English
1MathFractions5Middle School English
1MathEquations3Middle School English
1EnglishContractions4Middle School Math
1EnglishPrepositions2Middle School Math
1EnglishDiagramming3Middle School Math
1EnglishContractions4Middle School English
1EnglishPrepositions2Middle School English
1EnglishDiagramming3Middle School English
2MathDecimals5Middle School Math
2MathFractions5Middle School Math
2MathEquations3Middle School Math
2MathDecimals5Middle School English
2MathFractions5Middle School English
2MathEquations3Middle School English
2EnglishContractions3Middle School Math
2EnglishPrepositions4Middle School Math
2EnglishDiagramming3Middle School Math
2EnglishContractions3Middle School English
2EnglishPrepositions4Middle School English
2EnglishDiagramming3Middle School English

 

afaherty_1-1748444105430.png

 

Thank you in advance to anyone who can assist!

1 ACCEPTED SOLUTION

hello @afaherty 

 

this DAX for the average

Irwan_1-1748488579110.png

 

Test Average Score =
DIVIDE(
    [Overall Score Student 1]+[Overall Score Student 2],
    DISTINCTCOUNT('Table'[Student ID])
)
 
Hope this will help.
Thank you.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @afaherty,

As we haven’t heard back from you, we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Regards,
Vinay Pabbu

Irwan
Super User
Super User

hello @afaherty 

 

has the sample data above been unpivoted?

also how to get Average for Math = 12? is this 12 come from the duplicate as you mentioned?

 

apart from those, please check if this accomodate your need.

Irwan_0-1748473107810.png

not sure why but looks like your expected outcome is not matched with the sample data (perhaps because of the duplication).

nonetheless, since you want to show specific value of subtest and student id, you need to make different measure for each subtest and student id.

 

Hope this will help.

Thank you.

@Irwan Thanks! So I got 12 because student 1's score for Math is 11 (3+5+3) and student 2's score for Math is 13 (5+5+3). That makes 24, divided by 2 students = 12.

hello @afaherty 

 

this DAX for the average

Irwan_1-1748488579110.png

 

Test Average Score =
DIVIDE(
    [Overall Score Student 1]+[Overall Score Student 2],
    DISTINCTCOUNT('Table'[Student ID])
)
 
Hope this will help.
Thank you.

Thanks so much!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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