Forum Discussion
Modeling for SCD2 type fact table
I'm dealing with a model that has a fact table more closely modeled to an SCD 2.
InstalledServiceID ServiceLocationID ServiceID Service AccountID AddressID GeoCode InstalledFeatureID Qty Cost Price TotalNet MonthlyInstallment ARPU Installed ServiceStart ServiceEnd FeatureStart FeatureEnd RecordStart RecordEnd 112438 0 257 9783234324 16072 979117 2501737000 452999 1 0.0000 0.0000 0.0000 0.0000 0.00000000 1 2005-07-19 11:33:05.000 9999-09-09 00:00:00.000 2005-07-19 00:00:00.000 9999-09-09 00:00:00.000 2005-07-19 11:33:05.000 NULL
This table is essentially a service history table down to the SKU level tracking Monthly Recurring Revenue. Customers can change quantities of features within a contracted service over time, so these records capture each change.
In PowerBI I created the following DAX measure:
Base MRC =
VAR MAXDATE =
MAX ( ___DateDimension[Date] )
VAR MINDATE =
MIN ( ___DateDimension[Date] )
VAR CurrentFeatureService =
DATE ( 9999, 9, 9 )
VAR Historic =
SELECTEDVALUE ( __Filters[Show Historic?], FALSE () )
VAR EndDates =
ADDCOLUMNS (
ALL ( InstalledItems[InstalledFeatureID] ),
"Last Date", CALCULATE (
MAX ( InstalledItems[RecordStart] ),
KEEPFILTERS(FILTER (
InstalledItems,
InstalledItems[RecordStart] <= MAXDATE
&& InstalledItems[FeatureStart] <= MAXDATE
&& (
InstalledItems[RecordEnd] = BLANK ()
|| InstalledItems[RecordEnd] > MINDATE
)
&& InstalledItems[FeatureEnd] >= MINDATE
))
)
)
VAR FilteredDates =
TREATAS (
EndDates,
InstalledItems[InstalledFeatureID],
InstalledItems[RecordStart]
)
RETURN
IF (
Historic,
CALCULATE (
[Base Revenue],
FilteredDates,
ProductCatalog[RecurringPeriod] = "M"
),
CALCULATE (
[Base Revenue],
FilteredDates,
ProductCatalog[RecurringPeriod] = "M",
KEEPFILTERS(
FILTER(
InstalledItems,
InstalledItems[FeatureEnd] = CurrentFeatureService
&& InstalledItems[RecordEnd] = BLANK ()
)
)
)
)This works fine on the summary table to show month over month what the given MRR would have been by product.
When I implement drillthrough it tanks.
I'm trying to figure out a better way to model this that won't result in a petabyte of data. I need to be able to filter on a given date range and get any service that was active in that time period. If there are multiple records for that service due to changes, I would need the latest record.
5 Replies
- AnonymousNot applicable
I'm familiar with these articles, and I have a DAX measure to get me where I need. The problem is it's on a fact table (not a Dimension) so the table is huge (millions of records). When I try to drill through on a given summary, it tanks. Even in desktop I get the "exceeds available resources" and that's using filters down to a very small recordset.
- AnonymousNot applicable
Hi Anonymous ,
This issue occurs when a visual has attempted to query too much data with the available resources. As a workaround, you can try filtering the visual to reduce the amount of data in the result. And try removing details fields display on visuals. If you need that certain detail, consider reducing and adding a drill through chart to give you more information. Hope the following documentation can help you.
https://blog.crossjoin.co.uk/2020/01/20/visual-has-exceeded-the-available-resources-error-power-bi/
Best Regards
Rena