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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
sleopol
Frequent Visitor

Question about syntax, and past due calculation

Good morning everyone, 

 

So I was working on creating a past due formula that incorporates a custom date field into the logic. 

 

I got the date field to work fine, but when I went to use my new date with the original past due formula (see below) an error would occur once I hit future dates on the charting. 

 

Original Formula: 

 

Past Due Amount Recovery Plan =
VAR date_to_examine =
    MAX(DateKeyDummy[Date])
VAR sum_of_nov =
    CALCULATE(
        SUM(SupplierSchAgreement[Net Order Value]),
        FILTER(
            SupplierSchAgreement,
            date_to_examine > SupplierSchAgreement[Final Due Date]
        )
    )
VAR sum_of_dqv =
    CALCULATE(
        SUM(SupplierSchAgreement[Delivered Quantity Value (PD Amt)]),
        FILTER(
            SupplierSchAgreement,
            date_to_examine >= SupplierSchAgreement[Recovery Plan Original]
        ),
        FILTER(
            SupplierSchAgreement,
            date_to_examine > SupplierSchAgreement[Final Due Date]
        )
    )
RETURN
    sum_of_nov - sum_of_dqv
 
The above formula would do the below once a future date was reached, the sunbtraction and addition of past due stopped, and all values started adding to the past due; resulting in the ballooning effect below. 
 
Chart Error: 
 
 
sleopol_3-1668957372169.png

 

 

I tried to address this issue with some logic I had learned when researching the topic, and I keep getting a syntax error below: 

 

Syntax Error with New Formula: 

sleopol_1-1668956954981.png

 

This was after using the new formula below, with the logic being that if the final due date is greater than today, equals all the new custom date field, and the other dates are blank, then do an addition otherwise do a subtraction. I think the syntax below is incorrect, but I'm not sure where the issue might be occuring. 

 

New Formula:

Past Due Amount Recovery Plan with new logic =
VAR date_to_examine =
    MAX(DateKeyDummy[Date])
VAR Final_Due_Date_To_Examine = ALLNOBLANKROW(SupplierSchAgreement[Final Due Date])
VAR Transit_Date_To_Examine = ALLNOBLANKROW(SupplierSchAgreement[In-Transit Date])
VAR Confirmed_Date_To_Examine = ALLNOBLANKROW(SupplierSchAgreement[Latest Confirmed Date])
VAR Goods_Receipt_Date_To_Examine = ALLNOBLANKROW(SupplierSchAgreement[Latest Goods Receipt Date])
VAR RecoveryPlan = ALLNOBLANKROW(SupplierSchAgreement[Recovery Plan Original])

VAR sum_of_nov =
    CALCULATE(
        SUM(SupplierSchAgreement[Net Order Value]),
        FILTER(
            SupplierSchAgreement,
            date_to_examine > SupplierSchAgreement[Final Due Date]
        )
    )
VAR sum_of_dqv =
    CALCULATE(
        SUM(SupplierSchAgreement[Delivered Quantity Value (PD Amt)]),
        FILTER(
            SupplierSchAgreement,
            date_to_examine >= SupplierSchAgreement[Recovery Plan Original]
        ),
        FILTER(
            SupplierSchAgreement,
            date_to_examine > SupplierSchAgreement[Final Due Date]
        )
    )
RETURN
    IF(Final_Due_Date_To_Examine>TODAY()||Final_Due_Date_To_Examine=RecoveryPlan||Confirmed_Date_To_Examine = blank()||Goods_Receipt_Date_To_Examine = blank()||Transit_Date_To_Examine = blank(), sum_of_nov - sum_of_dqv,sum_of_nov + sum_of_dqv)
 
If anyone could help with the above syntax, or if there are any suggestions on how to incorporate a future date into the original formula, I would really appreciate it! 
 
Best Regards,
 
Stephen
1 ACCEPTED SOLUTION
speedramps
Super User
Super User

We want to help you but your description is too vaugue. Please write it again clearly.

Please DON'T copy & paste your DAX that does not work and expect us to wade through it and fathom what you want to do. That would be a bit crazy. 😀

Please just give a simple non technical functional decscription of what you want, then let us suggest the DAX. Thank you.

Provide example input data as table text (not a screen print) so we can import the data to build a solution for you.
Also provide the example desired output, with a clear description of the process flow.

Remember not to share private data ... we don't want you to get into trouble. 😧

Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.

You will get a quick response if you put time, care and effort into writing clear problem descriptions.

Vaugue descriptions can waste your time and ourtime.

Look foward to helping you when the above information is forthcoming

View solution in original post

3 REPLIES 3
sleopol
Frequent Visitor

Good morning, thank you for the reply, I'll follow the above advice and I'll post a better question. I'll try to replicate the issue in a sample dataset with fake data, thank you again for the advice, and have a great day! I'll close this question for now and post a new one with a more concise question. 

Look foward to helping you when the above information is forthcoming.

speedramps
Super User
Super User

We want to help you but your description is too vaugue. Please write it again clearly.

Please DON'T copy & paste your DAX that does not work and expect us to wade through it and fathom what you want to do. That would be a bit crazy. 😀

Please just give a simple non technical functional decscription of what you want, then let us suggest the DAX. Thank you.

Provide example input data as table text (not a screen print) so we can import the data to build a solution for you.
Also provide the example desired output, with a clear description of the process flow.

Remember not to share private data ... we don't want you to get into trouble. 😧

Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.

You will get a quick response if you put time, care and effort into writing clear problem descriptions.

Vaugue descriptions can waste your time and ourtime.

Look foward to helping you when the above information is forthcoming

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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