Forum Discussion
Divide by Count using a slicer
Hi,
I have a table that contains the columns hours & the week number of these hours.
I have a slicer using week number. If I select in the slicer for example -
Weeks 1 to 8
I want to divide the total hours offered in these weeks by 8. (Count of week number)
If I select Weeks 3 to 6 I want to divide total hours offered by 4 etc...
Tried using ALLSELECTED but this doesn't work.
Anonymous try following measure
Avg = DIVIDE ( SUM ( Table[Hours] ), COUNTROWS ( VALUES ( Table[WeekNumber] ) ) )I agree with the solution above as well. The table shown to the right is the raw data. The slicer limits the number of rows and associated Hours to the MEASURE. If this doesn't work, I'm assuming there's more to your raw data than just these two rows. Can you post a sample please.
FOrrest
3 Replies
- parry2k
Super User
Anonymous try following measure
Avg = DIVIDE ( SUM ( Table[Hours] ), COUNTROWS ( VALUES ( Table[WeekNumber] ) ) ) - fhill
Resident Rockstar
I agree with the solution above as well. The table shown to the right is the raw data. The slicer limits the number of rows and associated Hours to the MEASURE. If this doesn't work, I'm assuming there's more to your raw data than just these two rows. Can you post a sample please.
FOrrest- AnonymousNot applicable
Perfect. Works a treat. Thanks a million.