In Screenshot 2, I’m returning 2 slightly different Multiplication formula. On the right, the Column Total = the sum of the Rows, but Each Row doesn’t seem to be the Multiplication of the Columns to the left (i.e. 22389 * 6 * 0.941 = 126408 and not 134294). On the left, the Column Total (462621) does not = Sum of the Rows (509542).
Any chance of an explanation and advice on what to use for a correct result?
This all has to do with the way you’re using variables.
The SUMX and AVERAGEX whIch you have as variables really should be seperate measures which are then referenced within a master measure.
It’s all to do with the context that you have with in your total. The variables calculate very differently to what a measure does in a lot of cases just because of the context.
Also the CALCULATE Function that you are using after the return, is not really doing anything in these particular formula. Just wrapping it around SUMX is not really doing anything to the formula so you can remove it.
Check out these videos below which go over how to manage totals. See if you can get some ideas here that you can integrate into your formula.
I only put the variables into the measures so readers could view all the code in one place. The original model uses Measure Branching and no variables, but they produce the same incorrect outcome.
I have reviewed umpteen different videos (several from EnterpriseDNA and several others providers too) but nothing has helped me with this particular problem. The two links you provided were among the umpteen videos I reviewed before raising this Topic on the Forum.
When using SUMMARIZE, need to use SUMX before it in the measure. I’m with Sam, don’t think your ProdPermTerms # is correct. Don’t quite know if I have your measure setup correctly, but know for sure that you need to implement SUMX into your Summarize variable measure. I believe you are very close to figuring this out.
ACTUAL (PERM TERMS) TEST =
VAR ProdPermTerms =
SUM ( 'BI Data'[PB_EXFACTORY_GSV] ) * ( 1 - [Permanent Terms Factor] )
VAR DIVVY =
DIVIDE ( ProdPermTerms, GSV[PLAN (GSV)] )
VAR ProdPermTermsTOTAL =
SUMX (
SUMMARIZE ( 'BI Data', 'BI Data'[PB_EXFACTORY_GSV], "Actual", ProdPermTerms ),
ProdPermTerms * DIVVY
)
RETURN
IF (
HASONEVALUE ( 'BI Data'[Product Group] ),
ProdPermTerms,
ProdPermTermsTOTAL
)