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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
DevonVanDam
Helper I
Helper I

Calculate amount of days overdue (DYNAMIC)

Hi guys,

I currently have a dynamic report with all Sales data from 2017 to now. I use a year and a week slicer to show what cash is received in a week, what is newly invoiced and what the total amount of open items is.

I want to add the amount of overdue days based on the clearing date (= date payment is received) and the week + year that I have chosen in the slicers. So in week 40 of 2019 I want to see what is open (I already have that) and how many days it is overdue. Or not overdue. This should be based on the amount of days the formula gives.

Does anyone know the formula? I assume this is pretty simple so I don’t have to add my database?

Some fields I have
- clearing date
- invoice date
- due date

And I obviously have a date table!

Thanks,
Devon
1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @DevonVanDam ,

 

We could try to create measure using following formula and put into a table visual with a ID field to meet your requirement:

 

OverDueDay =
IF (
    AND (
        MAX ( 'Table'[DueDay] ) < MIN ( 'Calendar'[Date] ),
        OR (
            MAX ( 'Table'[ClearDay] ) < MIN ( 'Calendar'[Date] ),
            ISBLANK ( 'Table'[ClearDay] )
        )
    ),
    MIN ( 'Calendar'[Date] ) - MAX ( 'Table'[DueDay] ),
    BLANK ()
)

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-lid-msft
Community Support
Community Support

Hi @DevonVanDam ,

 

We could try to create measure using following formula and put into a table visual with a ID field to meet your requirement:

 

OverDueDay =
IF (
    AND (
        MAX ( 'Table'[DueDay] ) < MIN ( 'Calendar'[Date] ),
        OR (
            MAX ( 'Table'[ClearDay] ) < MIN ( 'Calendar'[Date] ),
            ISBLANK ( 'Table'[ClearDay] )
        )
    ),
    MIN ( 'Calendar'[Date] ) - MAX ( 'Table'[DueDay] ),
    BLANK ()
)

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
edhans
Super User
Super User

If you want to do this in DAX, you can use DATEDIFF() in a calculated column. 

 

In Power Query, you just add/subtract dates from each other. [Date1] - [Date2] for example, then format that type as a whole number.

 

In both cases, you just follow up with an IF() statement (or if then else in PQ if you want to do it there to minimize DAX calculations in the portal) to determine if it is past due or not. I don't think your slicer is relevent in this calculation unless I am missing something. It will simply show/hide data based on the slicer selection.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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