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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register 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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.