Column Totals not matching Sum of Rows

My DAX in the screenshots isn’t working.

In Screenshot 1, the Row calculations seem correct, but the Total of the Column isn’t the Sum of the Rows (it’s a lot lower: See Screenshot).

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.

Thanks
Sam

Thanks Sam,

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.

Any other ideas?

Ross

Can you add the PBIX file so that they can be reviewed. This will be the quickest way to work out what’s going on.

Just a slimmed down version of the scenario you’re working with would be fine if you can’t share the whole model.

Sam

My ‘slimmed-down’ PBIX is more than 5MB and the limit on this forum seems to be 4MB. Any suggestions?

Happy to share via the Power BI Web Service if that suits.

Is it not possible to filter out most of the data, or only leave the tables that matter for this solution?

As it only just he concepts we’re looking at here I think a really slimmed down version of just the essentials should be fine

Sam

Prophet Scorecard 2.2 Debug Example.pbix (152.6 KB)

Hi Sam, example pbix attached. Problem is in the Calculation of the Total of 'Actual (Perm Terms).

Cheers,

Ross

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
    )

Thanks
Enterprise%20DNA%20Expert%20-%20SmallProphet Scorecard 2.2 Debug Example (3).pbix (157.2 KB)