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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Mikevoc
Frequent Visitor

making a comparison between two years for Accounts Receivable

Hello,

I am trying to make a table which displays how many invoices are still open at the end of each month in PowerBI. I got the task to create a visualisation based on from an ERP software my company is using since they want more control over the visualisation. see following picture:

Mikevoc_0-1729510267787.png

 

The diagram shows how much is still open at the end of the month Jan, Feb, Mar, and so on during 2 different years.

I have created a table that includes Debtor code and name, Invoice date, Payment date, and amount.

 

Then I created a matrix based on the data available:

Mikevoc_1-1729510267789.png

 

With the following formula:

Sum Debits =

SUM('DebtorsInvoices’[Amount])

 

 

 

Which displays the total value correctly. For example I take code 100034 and on January. When I try doing it in excel, I see these values amounted to 95.945:

Mikevoc_0-1729510365859.png

However, what I want is the snapshot amount of open invoices during a specific year. For example, I want to see the amount of unpaid invoices during January 2023. In Excel, I would custom filter the invoice date to before 01/02/2023 and payment date either greater than 31/01/2023 or blank which will filter the invoice like this:

Mikevoc_1-1729510381235.pngMikevoc_2-1729510389932.png

 

Which equals to  20.282. How can I achieve this in PowerBI? I tried using the formula:

OpenInvoicesByMonth =

VAR _EndOfCurrentMonth = MAX('DateTable'[Date])

RETURN

CALCULATE(

    SUM('DebtorsInvoices’[Amount]),

    FILTER(

        'Debiteuren mutaties',

        [Invoice Date] <= _EndOfCurrentMonth &&

        (ISBLANK([PaymentDate]) || [PaymentDate] > _EndOfCurrentMonth)

    )

)

But, that formula displays the result only for the following invoices:

Mikevoc_3-1729510408433.png

 

How can I include the paid invoices as well?

Thank you for your assistance, and please bear with me as I am still new to PowerBI.

4 REPLIES 4
v-jiewu-msft
Community Support
Community Support

Hi @Mikevoc ,

Based on the description, drag the Date table date column to slicer visual and select the date. Then, using the following dax formula.

OpenInvoicesByMonth = 
VAR _EndOfCurrentMonth = MAX('DateTable'[Date]) 
RETURN 
CALCULATE( SUM('DebtorsInvoices'[Amount]), 'DebtorsInvoices'[InvoiceDate] <= _EndOfCurrentMonth && ( ISBLANK('DebtorsInvoices'[PaymentDate]) || 'DebtorsInvoices'[PaymentDate] > _EndOfCurrentMonth ) )

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-jiewu-msft,

Thank you for your reply. 

your formula returns an error:

The value for Invoice Date cannot be determined. Either the column doesn't exist, or there is no current row for this column.

 

the same goes for PaymentDate.



xifeng_L
Super User
Super User

Hi @Mikevoc 

 

You can try the following measure.

 

OpenInvoicesByMonth =

VAR _EndOfCurrentMonth = MAX('DateTable'[Date])

RETURN

CALCULATE(

    SUM('DebtorsInvoices’[Amount]),

    FILTER(

        ALL('Debiteuren mutaties'),

        [Invoice Date] <= _EndOfCurrentMonth &&

        (ISBLANK([PaymentDate]) || [PaymentDate] > _EndOfCurrentMonth) &&
        
        'Debiteuren mutaties'[Code] = MAX('Debiteuren mutaties'[Code])

    )

)

 

 

Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

 

Thank you~

hi @xifeng_L ,

 

Thank you for your response.

I tried using the formula you provided but it returns me this:

Mikevoc_0-1729581697322.png

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.