Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
DerekC
Frequent Visitor

Weighted Average

Looking for a way Count the number of times a certain dwell time shows up and divide it by the total count of rows shown if filtered.  Example: 54 shows up 2 times and there is 24 total rows that are on the page if filters are applied so weighted % is 2/24 = .0833333.  Then, I will take the Dwell Time x Weighted % = Dwell x Wgt %.  

 

DerekC_0-1661977240798.png

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@DerekC try this measure:

 

Count Measure = COUNTROWS ( Table )
Total Count Measure = CALCULATE ( [Count Rows], ALLSELECTED () )

Dwell x Wgt% Measure = 

SUMX ( 
   Table,
   VAR __dwellTime = Table[Dwell Time]
   VAR __dwellCount = CALCULATE ( [Count Measure], ALLSELECTED (), VALUES ( Table[Dwell Time] ) )
   VAR __weightedPercent = DIVIDE ( __dwellCount, [Total Count Measure] )
   RETURN
       __weightPercent * __dwellTime
)

   

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.



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

2 REPLIES 2
parry2k
Super User
Super User

@DerekC try this measure:

 

Count Measure = COUNTROWS ( Table )
Total Count Measure = CALCULATE ( [Count Rows], ALLSELECTED () )

Dwell x Wgt% Measure = 

SUMX ( 
   Table,
   VAR __dwellTime = Table[Dwell Time]
   VAR __dwellCount = CALCULATE ( [Count Measure], ALLSELECTED (), VALUES ( Table[Dwell Time] ) )
   VAR __weightedPercent = DIVIDE ( __dwellCount, [Total Count Measure] )
   RETURN
       __weightPercent * __dwellTime
)

   

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.



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.

Thank you very much.  I had to add another measure to get the result I wanted, but this got me 90% of the way there.  

I broke out the weighted percent variable into its own measure. 

VAR __weightedPercent = DIVIDE ( __dwellCount, [Total Count Measure] )

 

Then, then I had to create a new measure to SUMX the weighted percent and divide by the SUMX of the Dwell x wgt% Measure you helped me create.  

 
Wgt Avg Dwell =
VAR Sumdwellxwgt = SUMX("TABLE", [Dwell x Wgt% Measure])
VAR Sumwgtpercent = SUMX("TABLE", [Wgt%])

RETURN
Sumdwellxwgt / Sumwgtpercent

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.