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
Satish_Kumar
Helper V
Helper V

How to pick the correct payment date?

Hi All,

 

challenge.png

 

 In the picture, you can see that there is two payment date and I have to take the second payment date and there might multiple cases where payment comes in slots and I have to pick the last date of a particular invoiced against the payment received.

 

So please, Help me out of this!!!!

 

Regards,

Satish Kumar

 

1 ACCEPTED SOLUTION

Hi @Satish_Kumar,

 

Based on my test, the formula below should work in your scenario. Smiley Happy

Column = 
CALCULATE (
    MAX ( 'Table1'[Paymnet Date] ),
    FILTER (
        ALL ( 'Table1' ),
        'Table1'[Invoice Date] = EARLIER ( Table1[Invoice Date] )
            && 'Table1'[Document No_] = EARLIER ( Table1[Document No_] )
    )
)

c1.PNG

 

Regards

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

 

If you want the answer to be in a calculated column of the Data Model i.e. the PowerPivot, then try this

 

=CALCULATE(MAX(Data[Payment Date]),FILTER(Data,Data[Document No_]=EARLIER(Data[Document No_]))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur @v-ljerr-msft

 

https://drive.google.com/file/d/0Bxq6NdcHyxydVDZYcHh1WjJ3QU0/view?ts=59df17ae

 

This is the link where I put an excel sheet.

And I highlighted the payment date which should come against the Invoice Date.

 

 

 

Regards,

Satish 

 

Hi @Satish_Kumar,

 

Based on my test, the formula below should work in your scenario. Smiley Happy

Column = 
CALCULATE (
    MAX ( 'Table1'[Paymnet Date] ),
    FILTER (
        ALL ( 'Table1' ),
        'Table1'[Invoice Date] = EARLIER ( Table1[Invoice Date] )
            && 'Table1'[Document No_] = EARLIER ( Table1[Document No_] )
    )
)

c1.PNG

 

Regards

v-ljerr-msft
Employee
Employee

Hi @Satish_Kumar,

 

If I understand you correctly, you should be able to use the formula below to create a measure to get the last date of a particular invoiced against the payment received. Smiley Happy

measure =
VAR invoiceAmount =
    MAX ( 'Table1'[Invoice Amount LCY] )
VAR documentNo =
    MAX ( 'Table1'[Document No_] )
RETURN
    CALCULATE (
        MAX ( 'Table1'[Payment Date] ),
        FILTER (
            ALL ( 'Table1' ),
            'Table1'[Invoice Amount LCY] = invoiceAmount
                && 'Table1'[Document No_] = documentNo
        )
    )

Remark: just replace 'Table1' with your real table name.

 

Regards

@v-ljerr-msft

 

The solution you provided I tried But it is not displaying anything.

 

The Measure which was created with the formula you gave to me is showing blank value.

 

 

Regards,

Satish Kumar

 

 

 

Hi @Satish_Kumar,

 

Could you share a sample pbix file(with just some sample/mock data) which can reproduce the issue, so that we can further assist on it? You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.

 

Regards

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.