Skipcheck; #Region FeederCheck #Region Only needed if there are are negative weights in some of the dimensions # Reversing the flag value for elements consolidating with negative weights, can only work for a single rollup per dimension ['IsUnderfed'] = N: If (ElWeight('P&L Account', ElPar('P&L Account', !P&L Account, 1), !P&L Account) < 0, If (['IsFed'] = 0 & ['Value'] <> 0, -1, 0), Continue); # Using the Consolidated functions to override the weights to make sure flags are aggregated correctly ['IsOverfed'] = C: ConsolidatedCount(2, '', !Version, !Year, !Month, !Store, !P&L Account, !P&L Measure); # Check for level of each of the dimensions except for the measure dimension ['IsFed'] = C: If (ElLev('Version', !Version) > 0 % ElLev('Year', !Year) > 0 % ElLev('Month', !Month) > 0 % ElLev('Store', !Store) > 0 % ElLev('P&L Account', !P&L Account) > 0, ConsolidatedCount(2, '', !Version, !Year, !Month, !Store, !P&L Account, 'FeederFlag'), Continue); #EndRegion ['FeederFlag'] = N: 1; ['IsUnderfed'] = N: If (['IsFed'] = 0 & ['Value'] <> 0, 1, 0); # List all the dimensions in the cube as ConsolidateChildren parameters # Warning: perfomance on high-level views from large cubes will not be great (similar to clicking Check Feeders on a high-level consolidation) ['IsUnderfed'] = C: ConsolidateChildren('Version', 'Year', 'Month', 'Store', 'P&L Account', 'P&L Measure'); ['IsOverfed'] = N: If (['IsFed'] > 0 & ['Value'] = 0, 1, 0); ['OverfedRatio'] = C: ['IsOverfed'] \ ['IsFed']; ['FeederCheck'] = C: If ( ['IsUnderfed'] <> 0, -1 * ABS(['IsUnderfed']), If (['IsOverfed'] <> 0, 1 * ['IsOverfed'], 0)); #EndRegion Feeders; #Region FeederCheck ['Value'] => ['FeederFlag'], ['IsOverFed']; #EndRegion