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
Anonymous
Not applicable

PowerBI

Hi Friends

Here we have two tables I need to join two tables. My requirement here is AccountingDate should be the next date of InvoiceDate but not the maximum date as follows 

Table 1 - BillNo          InvoiceDate
               203               03-11-2017
               204               04-12-2019

Table 2 - BillNo         AccountingDate
               203                28-09-2010
               203                11-01-2017
               203                 03-11-2017
               203                 08-12-2020
               203                 29-09-2021
               204                 05-01-2020
               204                 07-08-2021

 

Output - BillNo            InvoiceDate           AccountingDate
                203                03-11-2017            08-12-2020
                204                04-12-2019            05-01-2020


Kindly help me to solve it. Thanks in advance

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Please try the following column:

 

AccDate = 
MINX (
    FILTER (
        AcntDate,
        AcntDate[BillNo] = Invoice[BillNo]
            && AcntDate[AccountingDate] > Invoice[InvoiceDate]
    ),
    AcntDate[AccountingDate]
)

vkkfmsft_0-1644285189767.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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

6 REPLIES 6
ValtteriN
Super User
Super User

Hi,

Try something like this:
Accounting date =
var _bill = MAX(Table1[BillNo]) return
CALCULATE(MAX(Table2[Accountingdate]),ALL(Table2),Table2[BillNo]=_bill,Table2[Accountingdate]<MAX(Table2[Accountingdate]))

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi

Getting this error

Keerthi_505_0-1643825332570.png

 

Try creating a measure based on the dax. For a column the syntax needs to be a bit different.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

I'm getting the same error

Hi @Anonymous ,

 

Please try the following column:

 

AccDate = 
MINX (
    FILTER (
        AcntDate,
        AcntDate[BillNo] = Invoice[BillNo]
            && AcntDate[AccountingDate] > Invoice[InvoiceDate]
    ),
    AcntDate[AccountingDate]
)

vkkfmsft_0-1644285189767.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

It worked, Thank you so much 

 
 
 

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.