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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Guilherme587171
Regular Visitor

I need to create a formula, but I don't know how

"Let's go, I have the inclusion date of the amount and the due date in the same table, and I need to include the included amount, the due amount, and a division that returns the percentage overdue in the same table. But in all the ways I've tried, it results in some conflict in the table and does not return the correct data...

Does anyone have any suggestions on how to solve this?

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Guilherme587171 ,

 

It would be nice to share an example and give the expected output.
I'm assuming you have a table like this:

vcgaomsft_0-1739414499704.png

I created a calendar table and created relationships:

vcgaomsft_1-1739414559283.png

Then please create these measures:

ShowValueForDates = 
VAR __last_date_with_data = CALCULATE(MAX('Table'[Due Date]),REMOVEFILTERS())
VAR __first_date_visible = MIN('Date'[Date])
VAR __result = __first_date_visible <= MIN(__last_date_with_data, TODAY())
RETURN
    __result
OverDue Count = 
VAR __today =
    TODAY ()
VAR __overdue_count =
    IF (
        [ShowValueForDates],
        CALCULATE (
            COUNTROWS ( 'Table' ),
            (
                'Table'[Date completed] = BLANK ()
                    && 'Table'[Due Date] <= __today
            )
                || ( 'Table'[Date completed] > 'Table'[Due Date] )
        )
    )
RETURN
    __overdue_count
Count ALL = COUNTROWS('Table')
Percentage Overdue = DIVIDE([OverDue Count],[Count ALL])
Cumulative Percentage Overdue = 
VAR __cumulative_overdue_count = IF([ShowValueForDates], CALCULATE([OverDue Count],FILTER(ALL('Table'),'Table'[Due Date]<=MAX('Date'[Date]))))
VAR __cumulative_count_all = IF([ShowValueForDates], CALCULATE([Count ALL],FILTER(ALL('Table'),'Table'[Due Date]<=MAX('Date'[Date]))))
RETURN
    DIVIDE(__cumulative_overdue_count,__cumulative_count_all)

[OverDue Amount] Similar to the above.

Output:

vcgaomsft_2-1739414786745.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

Poojara_D12
Super User
Super User

Hi @Guilherme587171 

To calculate the included amount, due amount, and overdue percentage in the same table without conflicts, you need to create separate DAX measures for each value. The included amount should sum values based on the inclusion date, while the due amount should sum values based on the due date. The overdue percentage is calculated as the ratio of the overdue amount to the total due amount. A key challenge is ensuring that date filters do not interfere with calculations, which can be managed using the CALCULATE() function with REMOVEFILTERS() or ALL() on the appropriate date column. Additionally, ensure that relationships between tables (if any) do not filter out relevant data unexpectedly. If issues persist, validating the data model structure and testing individual measures separately can help pinpoint errors.

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS

View solution in original post

2 REPLIES 2
Poojara_D12
Super User
Super User

Hi @Guilherme587171 

To calculate the included amount, due amount, and overdue percentage in the same table without conflicts, you need to create separate DAX measures for each value. The included amount should sum values based on the inclusion date, while the due amount should sum values based on the due date. The overdue percentage is calculated as the ratio of the overdue amount to the total due amount. A key challenge is ensuring that date filters do not interfere with calculations, which can be managed using the CALCULATE() function with REMOVEFILTERS() or ALL() on the appropriate date column. Additionally, ensure that relationships between tables (if any) do not filter out relevant data unexpectedly. If issues persist, validating the data model structure and testing individual measures separately can help pinpoint errors.

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
Anonymous
Not applicable

Hi @Guilherme587171 ,

 

It would be nice to share an example and give the expected output.
I'm assuming you have a table like this:

vcgaomsft_0-1739414499704.png

I created a calendar table and created relationships:

vcgaomsft_1-1739414559283.png

Then please create these measures:

ShowValueForDates = 
VAR __last_date_with_data = CALCULATE(MAX('Table'[Due Date]),REMOVEFILTERS())
VAR __first_date_visible = MIN('Date'[Date])
VAR __result = __first_date_visible <= MIN(__last_date_with_data, TODAY())
RETURN
    __result
OverDue Count = 
VAR __today =
    TODAY ()
VAR __overdue_count =
    IF (
        [ShowValueForDates],
        CALCULATE (
            COUNTROWS ( 'Table' ),
            (
                'Table'[Date completed] = BLANK ()
                    && 'Table'[Due Date] <= __today
            )
                || ( 'Table'[Date completed] > 'Table'[Due Date] )
        )
    )
RETURN
    __overdue_count
Count ALL = COUNTROWS('Table')
Percentage Overdue = DIVIDE([OverDue Count],[Count ALL])
Cumulative Percentage Overdue = 
VAR __cumulative_overdue_count = IF([ShowValueForDates], CALCULATE([OverDue Count],FILTER(ALL('Table'),'Table'[Due Date]<=MAX('Date'[Date]))))
VAR __cumulative_count_all = IF([ShowValueForDates], CALCULATE([Count ALL],FILTER(ALL('Table'),'Table'[Due Date]<=MAX('Date'[Date]))))
RETURN
    DIVIDE(__cumulative_overdue_count,__cumulative_count_all)

[OverDue Amount] Similar to the above.

Output:

vcgaomsft_2-1739414786745.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.