Hi all,
I thought I understood the ALL() function as effectively being 'remove filters', in that if you use the ALL function on a table it will remove any filters directly on that table, but not filters that are imposed by other related tables.
In my example I have an Invoices table which lists all invoices with the amounts, date they were received, and date they were paid, if they have been. This invoices table is connected to the calendar via the Doc.Date column (active) and Clearing column (inactive). This structure allows be to look at total amounts of invoices received or paid (via USERELATIONSHIP).
In addition I want to look at the amount of invoices outstanding at a given point. To do this I want to cycle through my invoice table and check the received date and paid date against the last date in the current filter context, and include all invoices that have been received but not paid. The below is the formula I have come up with; you could ignore the IF and Future Invoices parts, as this is only intended to prevent the graph showing current invoices outstanding into the future.
The below actually works, but I don't understand why. I would expect the ALL ( Invoices) to remove filters on the Invoices table directly, but thought the invoice table should still be effected by the filter applied to the Calendar table.
TLDR: Don't understand why ALL ( Invoices ) in the below formula is also removing the filter coming from the linked calendar table.
I thought I understood the ALL() function as effectively being 'remove filters', in that if you use the ALL function on a table it will remove any filters directly on that table, but not filters that are imposed by other related tables.
In my example I have an Invoices table which lists all invoices with the amounts, date they were received, and date they were paid, if they have been. This invoices table is connected to the calendar via the Doc.Date column (active) and Clearing column (inactive). This structure allows be to look at total amounts of invoices received or paid (via USERELATIONSHIP).
In addition I want to look at the amount of invoices outstanding at a given point. To do this I want to cycle through my invoice table and check the received date and paid date against the last date in the current filter context, and include all invoices that have been received but not paid. The below is the formula I have come up with; you could ignore the IF and Future Invoices parts, as this is only intended to prevent the graph showing current invoices outstanding into the future.
The below actually works, but I don't understand why. I would expect the ALL ( Invoices) to remove filters on the Invoices table directly, but thought the invoice table should still be effected by the filter applied to the Calendar table.
TLDR: Don't understand why ALL ( Invoices ) in the below formula is also removing the filter coming from the linked calendar table.
Code:
Invoices Outstanding =
VAR EndDate =
MAX ( 'Calendar'[Date] )
RETURN
IF (
[Future Invoices] =0,
BLANK(),
CALCULATE (
[Net Invoices],
FILTER (
ALL ( Invoices ),
Invoices[Doc. Date] <= EndDate
&& (
Invoices[Clearing] > EndDate
|| ISBLANK ( Invoices[Clearing] )
)
)
)
)