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

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.

2 ACCEPTED SOLUTIONS
parry2k
Super User
Super User

@Qotsa try following measure

 

Avg = 
DIVIDE ( 
SUM ( Table[Hours] ), 
COUNTROWS ( VALUES ( Table[WeekNumber] ) ) 
)

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

fhill
Resident Rockstar
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

 

Capture3.PNG




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




View solution in original post

3 REPLIES 3
fhill
Resident Rockstar
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

 

Capture3.PNG




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




Perfect. Works a treat. Thanks a million.

parry2k
Super User
Super User

@Qotsa try following measure

 

Avg = 
DIVIDE ( 
SUM ( Table[Hours] ), 
COUNTROWS ( VALUES ( Table[WeekNumber] ) ) 
)

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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