Forum Discussion
Average for different groups instead of total data
Hello,
Tried a few different things this afternoon but to no avail.
I'm taking data from a folder full of Excel files containing the following data:
| Name | Session | Duration | Distance |
| A | Matchday | 78 | 10000 |
| B | Matchday | 93 | 12000 |
| C | Matchday | 93 | 13400 |
| D | Matchday | 93 | 12200 |
| E | Matchday | 93 | 11000 |
| A | training | 60 | 8000 |
| B | training | 60 | 8000 |
| C | training | 60 | 8000 |
| D | training | 60 | 8000 |
| E | training | 60 | 8000 |
| A | Matchday | 93 | 12000 |
| B | Matchday | 93 | 13000 |
| C | Matchday | 93 | 11000 |
| D | Matchday | 71 | 9000 |
| E | Matchday | 93 | 10000 |
I'm looking to present this data in a vizualisation that shows the Average Distance each person covered, when the session is a matchday and the duration was longer than 90. I'm currently using: Measure = Calculate(AVERAGE(Distance), [session]="Matchday"&&[duration]>90) which is giving the total average output in the table but the individual names are remaining blank. I can't figure out how to edit my formula in a way that shows each person's individualised average data in the table, which I then want to use to take each training distance as a % in a subsequent measure.
Any help would be much appreciated!
Many Thanks
Hi SUTTY ,
According to your description, you need to add a grouping condition. Refer to the following test results:
Column = IF ( 'Table (2)'[Session] = "training", BLANK (), CALCULATE ( AVERAGE ( 'Table (2)'[Distance] ), FILTER ( ALL ( 'Table (2)' ), 'Table (2)'[Session] = "Matchday" && 'Table (2)'[Duration] > 90 && 'Table (2)'[Name] = EARLIER ( 'Table (2)'[Name] ) ) ) )
If the problem is still not resolved, please provide detailed error information and a screenshot of the desired result. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- v-henryk-mstf
Community Support
Hi SUTTY ,
According to your description, you need to add a grouping condition. Refer to the following test results:
Column = IF ( 'Table (2)'[Session] = "training", BLANK (), CALCULATE ( AVERAGE ( 'Table (2)'[Distance] ), FILTER ( ALL ( 'Table (2)' ), 'Table (2)'[Session] = "Matchday" && 'Table (2)'[Duration] > 90 && 'Table (2)'[Name] = EARLIER ( 'Table (2)'[Name] ) ) ) )
If the problem is still not resolved, please provide detailed error information and a screenshot of the desired result. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- SUTTYFrequent Visitor
That's great thanks Henry!
I think my issue was I was trying to get it as a measure but completely forgot how easy using columns are!