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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
Most Valuable Professional
Most Valuable Professional

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
Most Valuable Professional
Most Valuable Professional

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors