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
Oomsen
Helper III
Helper III

Debtors paid on time

I have the following columns and would like to create a measure which counts the days between payment and invoice date. At the end i would like to know which debtor pays on time and which don't. 

DateInvoice numberJournalcode 
1-3-201812345678925(Payment)
15-4-201812345678970(Invoice)
1 ACCEPTED SOLUTION

Hi @Oomsen

 

Add a measure to get the amount as below. Here is the sample file.

Amount =
VAR a =
    SUMMARIZE ( Table1, Table1[Journalcode], Table1[Invoice number], "b", [Diff] )
RETURN
    SUMX ( a, [b] )

1.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
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

9 REPLIES 9
v-cherch-msft
Employee
Employee

Hi @Oomsen

 

You may refer to below measure:

Measure =
DATEDIFF (
    CALCULATE (
        MAX ( Table1[Date] ),
        FILTER ( ALL ( Table1 ), Table1[Date] < MAX ( Table1[Date] ) )
    ),
    MAX ( Table1[Date] ),
    DAY
)

1.png

 

Regards,

Cherie

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

I think it is working, thanks for that. But it doesn't give the result i expected. There are also transactions in the column which doesn't need to be count. I'm only looking for sales invoices and payments which can be based on journalcode 25 (payment) and 70 (invoice). 

Hi @Oomsen

 

Could you provide more details for your scenario so that i could help further on it?

 

Regards,

Cherie

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

For sure. My table is called transactions and hold all financial transactions of our current administration. The table includes data like Date, Amount, Client/Supplier, GL account, etc. My goal is to find out that my customers are paying avrage on the 30 days that we have agreed. My idea wass to measure this bij counting the days between payment and invoice based on journalcode. 

Hi @Oomsen

 

I add some data in the sample. You may refer to it and check if it matches what you need.

Measure2 =
VAR a =
    IF (
        MAX ( Table1[Journalcode] ) = 70,
        CALCULATE (
            MAX ( Table1[Date] ),
            FILTER (
                ALLEXCEPT ( 'Table1', Table1[Invoice number] ),
                Table1[Journalcode] = 25
            )
        )
    )
RETURN
    DATEDIFF ( a, MAX ( Table1[Date] ), DAY )

1.png

 

Regards,

Cherie

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

I think this is not correct, the results are like -982.  i also need notice that the transaction on journalcode 25 will always be later in time then 70.

Hi @Oomsen

 

Could you explain how to get the results like -982? I think i'm not fully understand it. It's better you can give some sample data and how to get the expected results.

 

Regards,

Cherie

 

 

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

That was the result of the presented formule up here. 

Below some expamle data of one invoice and payment. the table includes a lot of these invoices and other transactions. That's why i had the idea to select bij journalcode. Journalcode 70 is the invoice and journalcode 25 is the payment. I want to calculate the amount of days between invoice and payment.  

TransactionsTransactions

Hi @Oomsen

 

Add a measure to get the amount as below. Here is the sample file.

Amount =
VAR a =
    SUMMARIZE ( Table1, Table1[Journalcode], Table1[Invoice number], "b", [Diff] )
RETURN
    SUMX ( a, [b] )

1.png

 

Regards,

Cherie

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

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.