I have a model for Payables Ageing Analysis with:
- A Bar Chart
- A Pie Chart
- A Table
- A dynamic date slicer
The date slicer sets “Date Selected” which allows for a “Days Left” per transaction to be dynamically calculated:
Days Left =
//Days left where Selected Date >= Posting Date AND (Selected Date < Clearing Date OR = BLANK)
IF( AND( [Posting Date] <= [DateSelected],
OR([Clearing Date] > [DateSelected], [Clearing Date] = BLANK())),
DATEDIFF( [DateSelected],[Due Date], DAY ),
BLANK() )
The chart uses this code to then place the transactions in buckets for the bars:
_A0_ PayablesPerGroup_Chart =
CALCULATE(
[_A0_ OutstandingAmount],
FILTER(
_FACT_BSEG_AP,
COUNTROWS(
FILTER(
'AgedGroups_Chart',
IF(
( 'AgedGroups_Chart'[Min] < 0
|| 'AgedGroups_Chart'[Min] == 0 )
&& ( 'AgedGroups_Chart'[Max] > 0
|| 'AgedGroups_Chart'[Max] == 0 ),
( ( [Days Left] < 0
&& [Days Left] >= 'AgedGroups_Chart'[Min] )
|| [Days Left] == 0 )
|| ( ( [Days Left] > 0
&& [Days Left] <= 'AgedGroups_Chart'[Max] )
|| [Days Left] == 0 ),
[Days Left] >= 'AgedGroups_Chart'[Min]
&& [Days Left] <= 'AgedGroups_Chart'[Max]
)
)
) > 0
)
)
(Same sort of code for the Pie Chart.)
The problem:
I would like the Bar Chart to filter the table.
So if the end user clicks the 30+ bar, they should only see the transactions with days left greater than 30.
Why not Calculated Columns?
I know this is theoretically possible by creating calculated columns for Days Left and the Groupings/buckets and then connecting a Grouping Table to the Fact Table.
However, I am dealing with 1.5 million rows in the live dataset. Performance is already an issue, so having two calculated columns recalculate each time somebody touches the slicer would take far too long to process I fear.
Is there some other way of doing this that would not require Calculated Columns?
Demo File:
Dynamic_Chart_Interaction_Table.pbix (1.0 MB)