Forum Discussion
ALL() giving performance issues
NEW Version
Total Split - BAE_BLS All newtry =
OLD Version
Total Split - BAE_BLS All =
- v-aatheeque1 year ago
Community Support
Total Split - BAE_BLS All (Fixed) =
VAR Yr =
SELECTEDVALUE ( 'Base Year'[Year] )-- Store values to be reused inside TREATAS
VAR TrtValues = VALUES ( 'AllocationKey Man.Fee'[Entitycode] )-- Net Sales Total
VAR full =
CALCULATE (
[Amount Adjusted],
DimScenarioDetailed[Scen_Level1] = "FA",
'Date'[Year] = Yr,
DimAccountDetailed[Net Sales Total] = 1,
TREATAS ( TrtValues, DimEntity[Entity_flat_NodeName] ),
ALL ()
)VAR BLS =
CALCULATE (
CALCULATE (
[Amount Adjusted],
DimScenarioDetailed[Scen_Level1] = "FA",
'Date'[Year] = Yr,
DimAccountDetailed[Net Sales Total] = 1,
TREATAS ( TrtValues, DimEntity[Entity_flat_NodeName] ),
ALL ()
),
'AllocationKey Man.Fee'[BA-Allocation] = "BAE_BLS"
)VAR NetResult =
DIVIDE ( BLS, full ) * Factor[Net sales factor] -- Net Sales Section-- Last date of year
VAR lastD =
CALCULATE (
LASTDATE ( 'Fact'[Date] ),
FILTER ( ALL ( 'Date' ), 'Date'[Year] = Yr )
)-- Balance Sheet Section
VAR balancesheet =
CALCULATE (
[Amount Adjusted],
DimScenarioDetailed[Scen_Level1] = "FA",
DimAccountDetailed[BalanceSheet] = 1,
TREATAS ( TrtValues, DimEntity[Entity_flat_NodeName] ),
ALL (),
'Date'[Date] = lastD
)VAR balan =
CALCULATE (
CALCULATE (
[Amount Adjusted],
DimScenarioDetailed[Scen_Level1] = "FA",
DimAccountDetailed[BalanceSheet] = 1,
TREATAS ( TrtValues, DimEntity[Entity_flat_NodeName] ),
ALL (),
'Date'[Date] = lastD
),
'AllocationKey Man.Fee'[BA-Allocation] = "BAE_BLS"
)VAR Bal =
DIVIDE ( balan, balancesheet ) * Factor[Prod.asset factor]-- P&L Section
VAR profit =
CALCULATE (
[Amount Adjusted],
DimScenarioDetailed[Scen_Level1] = "FA",
'Date'[Year] = Yr,
DimAccountDetailed[P&L] = 1,
TREATAS ( TrtValues, DimEntity[Entity_flat_NodeName] ),
ALL ()
)VAR prof =
CALCULATE (
CALCULATE (
[Amount Adjusted],
DimScenarioDetailed[Scen_Level1] = "FA",
'Date'[Year] = Yr,
DimAccountDetailed[P&L] = 1,
TREATAS ( TrtValues, DimEntity[Entity_flat_NodeName] ),
ALL ()
),
'AllocationKey Man.Fee'[BA-Allocation] = "BAE_BLS"
)VAR ProResult =
DIVIDE ( prof, profit ) * Factor[Conv.cost factor]-- Final Result
VAR result = NetResult + Bal + ProResultRETURN
result
Hope this helps !!- fjjpeeters19761 year ago
Helper III
Hi, when I incorporate your solution my number changes, so I guess the evaluation of the variable in the context is different from the evaluation in the part of the function itself.
BR,
Frank
- v-aatheeque1 year ago
Community Support
Hi fjjpeeters1976
Thanks for getting back!To help us understand the issue better, could you let us know which part of the calculation seems off is it the NetResult, Bal, or ProResult? Also, are you testing the formula in a specific visual like a matrix or card, or looking at it from a total level?
Let us know if there are any filters applied, such as year, entity, or scenario. Lastly, if possible, please share what result you were expecting and what value you’re seeing instead.
This will help us verify whether it’s a context evaluation issue or something specific to your data model.