Forum Discussion
Calculating overdues over time with DAX
- 8 years ago
Check the DAX below.
Measure = CALCULATE ( SUM ( Duplicatas[Value] ), FILTER ( ALL ( Duplicatas ), Duplicatas[State] = "approved" && Duplicatas[Due Date] < MIN ( Dates[Date] ) && ( Duplicatas[Paid Date] = BLANK () || Duplicatas[Paid Date] > MAX ( Dates[Date] ) ) ) ) - 8 years ago
Thanks a lot! The following ended up working:
(R$) Overdue Invoices = CALCULATE ( SUM ( Duplicatas[Value] ), FILTER ( ALL ( Duplicatas ), Duplicatas[State] = "approved" && Duplicatas[Current Due Date] < MIN( MAX( Dates[Date] ), TODAY() ) && ( Duplicatas[Paid Date] = BLANK () || Duplicatas[Paid Date] > MAX ( Dates[Date] ) ) ) )
You just need to use the measure below.
Measure =
CALCULATE (
SUM ( Duplicatas[Value] ),
USERELATIONSHIP ( Duplicatas[Due Date], Dates[Date] ),
Duplicatas[State] = "approved",
Duplicatas[Paid Date] = BLANK ()
)
Thanks a lot v-chuncz-msft!
This formula works in parts:
It shows which invoices were due in each month that still haven't been paid. However, in October, it shows invoices that are still current (e.g. due only on Oct-30) as well.
What I am looking for is, at any given Dates[Date], the total value of invoices where the Duplicatas[Due Date] < Dates[Date].
Basically like this:
Note: I am duplicating the SUMIFS because there are two ways an invoice can be over due: Paid Date is empty (invoice hasn't been paid), or Paid Date is > Due Date (invoice was paid late, i.e. was overdue at some point).
- v-chuncz-msft8 years ago
Community Support
Check the DAX below.
Measure = CALCULATE ( SUM ( Duplicatas[Value] ), FILTER ( ALL ( Duplicatas ), Duplicatas[State] = "approved" && Duplicatas[Due Date] < MIN ( Dates[Date] ) && ( Duplicatas[Paid Date] = BLANK () || Duplicatas[Paid Date] > MAX ( Dates[Date] ) ) ) )- Dax_Rookie8 years agoFrequent Visitor
Thanks a lot! The following ended up working:
(R$) Overdue Invoices = CALCULATE ( SUM ( Duplicatas[Value] ), FILTER ( ALL ( Duplicatas ), Duplicatas[State] = "approved" && Duplicatas[Current Due Date] < MIN( MAX( Dates[Date] ), TODAY() ) && ( Duplicatas[Paid Date] = BLANK () || Duplicatas[Paid Date] > MAX ( Dates[Date] ) ) ) )