DAX CALCULATE Using MAX Error

SimonNU

Board Regular
Joined
Jul 11, 2013
Messages
140
Hi Guys

I'm trying to sum up all values from the current period. I assumed the below would work:

Code:
=CALCULATE(sum('UTILIZATION SHEETS'[CS]),'UTILIZATION SHEETS'[Period]=max('UTILIZATION SHEETS'[Period]))

But I receive:

"Calculation error in measure 'UTILIZATION SHEETS'[Measure 1]: A function 'MAX' has been used in a True/False expression that is used as a table filter expression. This is not allowed."

Typing in the latest period, e.g. 11 instead of "max('UTILIZATION SHEETS'[Period])", works but this obviously isn't ideal.

Does anyone have a solution?


Thanks!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
perhaps a massive case statement i.e.


select case max('UTILIZATION SHEETS'[Period])


case 1
=CALCULATE(sum('UTILIZATION SHEETS'[CS]),'UTILIZATION SHEETS'[Period]=1)
case 2
=CALCULATE(sum('UTILIZATION SHEETS'[CS]),'UTILIZATION SHEETS'[Period]=2)
case 3
=CALCULATE(sum('UTILIZATION SHEETS'[CS]),'UTILIZATION SHEETS'[Period]=3)
case 4
=CALCULATE(sum('UTILIZATION SHEETS'[CS]),'UTILIZATION SHEETS'[Period]=4)
case 5
=CALCULATE(sum('UTILIZATION SHEETS'[CS]),'UTILIZATION SHEETS'[Period]=5)


etc...
 
Upvote 0
Your first instinct was correct -- though, you can probably also use VALUES('UTILIZATION SHEETS'[Period]).

When you see "____ has been used in a True/False expression that is used as a table filter expression. This is not allowed." It always means "I did something complicated in my call to calculate, I need to use FILTER() instead".

=CALCULATE(sum('UTILIZATION SHEETS'[CS]), FILTER('UTILIZATION SHEETS', 'UTILIZATION SHEETS'[Period]=max('UTILIZATION SHEETS'[Period])))

And you should be good.
 
Upvote 0

Forum statistics

Threads
1,224,020
Messages
6,175,970
Members
452,691
Latest member
Tony_Almeida

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top