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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
burny81
New Member

Calculate line chart of unpaid invoices for dates in the past

Hello,

 

I am attempting to create a line chart for the last two years in which the sum of the unpaid invoices is shown, wherein the line chart shows the amount of unpaid invoices at that date in the past.

 

I have an invoice table having the "invoicing date", the "invoice amount" and the "paid date".

 

I created a date table with the dates of the last two years and wanted to create an additional column in the date table having the sum of unpaid invoices for the respective date.

 

The data looks like this:

 

Invoices Table   
Invoice Number Invoice Amount Invoicing DatePaid Date
1 $          300,002022-03-012022-03-07
2 $          500,002022-03-022022-03-10
3 $          250,002022-03-032022-04-01
4 $          150,002022-03-042022-03-05
5 $          700,002022-03-042022-03-10

 

Date Table
Date
01.01.2020
02.01.2020
03.01.2020
04.01.2020
05.01.2020
30.12.2022

 

The result that I expect should e.g. be $300 for 2022-3-1, $0 for 2022-2-28 or $250 for each date between 2022-3-10 and 2022-3-31. 

 

To get these results I believe I have to do two comparisons:

 

1. invoice table[invoicing date] <= date table[date]

&&

2. invoice table[paid date] > date table[date]

 

Then I have to SUM all rows for invoice table[invoice amount] that remain (which should be the amount of all invoices that had been sent out but had not yet been paid at that specific date in the past).

 

My problem is that Power Bi does not allow me to do the two comparisons because the data is from two differnt tables.

 

What can I do?

 

Thank you very much!

 

Best regards

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @burny81 

Thanks for reaching out to us.

please try this measure

sum of unpaid invoices = SUMX(FILTER('Table','Table'[Invoicing Date]<=MIN('calendar'[Date]) && 'Table'[Paid Date]>MIN('calendar'[Date])),[Invoice Amount])

vxiaotang_0-1666346410226.png

 

Best Regards,

Community Support Team _Tang

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

View solution in original post

3 REPLIES 3
v-xiaotang
Community Support
Community Support

Hi @burny81 

Thanks for reaching out to us.

please try this measure

sum of unpaid invoices = SUMX(FILTER('Table','Table'[Invoicing Date]<=MIN('calendar'[Date]) && 'Table'[Paid Date]>MIN('calendar'[Date])),[Invoice Amount])

vxiaotang_0-1666346410226.png

 

Best Regards,

Community Support Team _Tang

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

Dinesh_Suranga
Continued Contributor
Continued Contributor

@burny81 

Hi,

Could you please share some sample data?

 Thank you 

Hi, 

 

I added the sample data in the original post.

 

Best regard

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.