Column Totals not working even with HASONEVALUE

I need to understand why my measures in columns 2 and 4 are not totaling correctly. Here is my table.

Here are the measures for each column:

COLUMN 1:

``````Total Credit Adjustment =
``````

COLUMN 2:

``````Credit Adjustment Total =
RETURN
IF( HASONEVALUE('PBI_FSCAPF'[YEAR-MO] ),
``````

COLUMN 3:

`Credit Adjusment Less Inv Credits = [Total Credit Adjustment]-[Total Inv Credits]`

COLUMN 4:

``````Credit Adjustment Less Inv Credits Total =
RETURN
IF( HASONEVALUE('PBI_FSCAPF'[YEAR-MO] ),
``````

I would think that these measures would work, but I’m getting totals that don’t make any sense.

Any help would be greatly appreciated!

Note: PBI_FSCAPF is my DATE table.

This is quite common and has everything to do with the context within the totals.

I see you’re already using good technique here to solve these so will have to look deeper at this.

Will come back with a better answer shortly. Thanks

Ok had another good look and realised the problem.

It’s actually to do with the initial measure you have here

``````Total Credit Adjustment =
``````

This becomes an issue in the total, because the MAX results is always calculating to 12 and therefore 375,000

375,000 * 3 = 1,125,000 (which is the current total)

So it’s all to do with context here.

Because there is none in the total, every MAX( ) calc being done is look at the whole column inserted and finding the max value in the page context. So therefore 12.

Instead of using this formula initially what you’ll need to do is use an iterating function instead.

``````SUMX( VALUES( YEAR-MO ),
``````

I believe this should do it.

See if you can work the same logic into your other calcs. It will be very similar.

Let me know.

Thanks

Sam,
I tried your suggestion and unfortunately, it did not work. I got the same results (1,125,000). However, something you said got me to thinking. You initially said that the MAX() measure was forcing it to calculate to 12, hence the 1,125,000. So on a whim, I removed the MAX() from the Total Credit Adjustment measure and that corrected my totals! Further, I did not have to create another measure using HASONEVALUE(). Here is my measure (which now works):

This change makes the other “branched” measure work: