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.
Hi,
I have a table with data like this:
What I need is to get the median of each row that has the same Question and Teacher.
So, Question 1 for John would be: 8 + 5 = 13/2 = 6,5
Is this possible?
Solved! Go to Solution.
Hi @Idigorasu ,
Please remember never post pictures of tables, it is completely useless to the people who are helping you and now we have to type over your date (which could have been avoided and sped up the process of helping you :)).
It isn't clear if you want a calculated column or a measure so I assume a calculated column for now.
The second thing is the word 'median' which means something else than 'average'. The median of a set of numbers is that number where half the numbers are lower and half the numbers are higher. The average of a set of numbers is the total of those numbers divided by the number of items in that set. The median and the average might be close, but they could also significantly different. It all depends on the numbers.
In your case, you are looking at the average ( ( 8 + 5 ) / 2) = 13. So I am going to assume you meant average and not median.
The calculated column dax is this:
AverageTeacherQuestion =
VAR _curTeacher = Table2[Teacher]
VAR _curQuestion = Table2[Question]
RETURN
AVERAGEX(FILTER(Table2, Table2[Question] = _curQuestion && Table2[Teacher] = _curTeacher), [Score])
Resulting in this:
You can find my PBIX here, it is Table2 and you can ignore other tables (these are for other questions). Let me know if this works for you!
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Hi @Idigorasu.,
You can use the following measure formula to get average aggregate based on filtered table records and current row contents 'Question','Teacher' categories labels.
Measure =
CALCULATE (
AVERAGE ( Table[Score] ),
ALLSELECTED ( Table ),
VALUES ( Table[Question] ),
VALUES ( Table[Teacher] )
)
Regards,
Xiaoxin Sheng
Hi @Idigorasu ,
Please remember never post pictures of tables, it is completely useless to the people who are helping you and now we have to type over your date (which could have been avoided and sped up the process of helping you :)).
It isn't clear if you want a calculated column or a measure so I assume a calculated column for now.
The second thing is the word 'median' which means something else than 'average'. The median of a set of numbers is that number where half the numbers are lower and half the numbers are higher. The average of a set of numbers is the total of those numbers divided by the number of items in that set. The median and the average might be close, but they could also significantly different. It all depends on the numbers.
In your case, you are looking at the average ( ( 8 + 5 ) / 2) = 13. So I am going to assume you meant average and not median.
The calculated column dax is this:
AverageTeacherQuestion =
VAR _curTeacher = Table2[Teacher]
VAR _curQuestion = Table2[Question]
RETURN
AVERAGEX(FILTER(Table2, Table2[Question] = _curQuestion && Table2[Teacher] = _curTeacher), [Score])
Resulting in this:
You can find my PBIX here, it is Table2 and you can ignore other tables (these are for other questions). Let me know if this works for you!
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Hi @JarroVGIT ,
I just started with PowerBI and this community has helped me so much, thank you for your work.
Have a nice day.
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
97 | |
95 | |
80 | |
77 | |
66 |
User | Count |
---|---|
130 | |
106 | |
105 | |
86 | |
72 |