Forum Discussion
AVERAGE AGE with repeted values
- 5 years ago
Hi mellolu ,
Based on the measure AlB provided, you can also create a measure like so:
Avg Age = CALCULATE ( AVERAGEX ( DISTINCT ( 'Table'[Name] ), CALCULATE ( MIN ( 'Table'[Age] ) ) ), ALLSELECTED ( 'Table' ) )Best regards
Icey
If this post helps, then consider Accepting it as the solution to help other members find it faster.
Hi mellolu
If you do not show a sample of your data and the expected result, it is difficult to provide an accurate answer.
Try this measure in a card visual:
AvgAge =
AVERAGEX ( DISTINCT ( [PersonID] ), CALCULATE ( MIN ( Table1[Age] ) ) )
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
- mellolu5 years agoFrequent Visitor
Table1
Name Age
Name1 20
Name2 15
Name1 20
Name3 30
Age Average should be 21.67, but in my project it is 21,25 (because one student appears more than once)
I don't know if I was clear...
- AlB5 years ago
Community Champion
You were clear. that is exactly what the code I suggested earlier does. I will repeat it here:
AvgAge = AVERAGEX ( DISTINCT ( Table1[Name] ), CALCULATE ( MIN ( Table1[Age] ) ) )Another option would be to eliminate the duplicates in the query editor, so that you do not have to worry about them when calculating the average. See it all at work in the attached file.
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers