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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
czuniga
Helper III
Helper III

Weighted Average

I have a dataset similar to this: 

 

Claim #DateSubmittedDate Paid# Of Days Between Date Submitted & DatePaid OR # Of Days Since Submitted
543213/1/20213/15/202114
543213/2/20213/16/202114
543213/3/20213/17/202114
543213/4/20213/18/202114
543213/5/20213/19/202114
543213/6/20213/20/202114
543213/7/20213/21/202114
543213/8/20213/22/202114
543213/9/20213/23/202114
543213/10/20213/24/202114
543213/11/20213/25/202114
543213/12/20213/26/202114
543213/13/20213/27/202114
543213/14/20213/28/202114
543213/15/20213/29/202114
543213/16/2021 13
543213/17/2021 12
543213/18/2021 11
543213/19/2021 10
543213/20/2021 9
543213/21/2021 8
543213/22/2021 7
543213/23/2021 6
543213/24/2021 5
543213/25/2021 4

I need to get the average of the "# Of Days Between Date Submitted & DatePaid OR # Of Days Since Submitted" that includes all of the rows with no pay date, but of the rows that do have a pay date, only those that have a pay date within the last 30 days. 

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @czuniga ,

 

the following measure should fulfil your criteria:

Average if not paid or 30 days =
CALCULATE(
    AVERAGE( myTable[# Of Days Between Date Submitted & DatePaid OR # Of Days Since Submitted] ),
    FILTER(
        myTable,
        myTable[Date Paid] = BLANK() || DATEDIFF( myTable[Date Paid], TODAY(), DAY ) <= 30
    )
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
 

View solution in original post

3 REPLIES 3
selimovd
Super User
Super User

Hey @czuniga ,

 

the following measure should fulfil your criteria:

Average if not paid or 30 days =
CALCULATE(
    AVERAGE( myTable[# Of Days Between Date Submitted & DatePaid OR # Of Days Since Submitted] ),
    FILTER(
        myTable,
        myTable[Date Paid] = BLANK() || DATEDIFF( myTable[Date Paid], TODAY(), DAY ) <= 30
    )
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
 

If I wanted to view this same information on a rolling basis, how could I do that?

 

I have this so far, but something is off: 

 

Average if not paid or 30 days = CALCULATE( AVERAGE( Claims[Avg Days Outstanding] ), FILTER(
ALLSELECTED(Claims ), Claims[DateService] <= max(Rolling_Calendar_Lookup[Date]) || DATEDIFF( Claims[PayDate], max(Rolling_Calendar_Lookup[Date]), DAY ) <= 30 ) )

Worked perfectly. Thank you!

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.