Reputation: 5
I am trying to create the following measure but it fails.
Measure = CALCULATE(COUNTA(Data[Total]),Data[Total]>0, Max(Period=Max Calculated Period).
DAX complained with the following error message:
"A function 'MAX' has been used in a True/False expression that is used as a table filter expression. This is not allowed."
I am trying to filter the result to the maximum period selected in a slicer. Please advise.
Upvotes: 0
Views: 805
Reputation: 1776
I've ran into similar situations. What seems to work is to put the Max Calculated Period
into a variable in the measure and make a couple other tweaks to the definition.
Some assumptions I am making:
Max Calculated Period
is a measure defined within Power BIPeriod
is a column in you Data
tableIf either of those are incorrect, this solution will not work and I would encourage you to update your question with more information and a data sample.
What that would look like is:
Measure =
VAR MaxPeriod = [Max Calculated Period]
RETURN
CALCULATE(
COUNTA(Data[Total]),
Data[Total] > 0,
Data[Period] = MaxPeriod
)
Upvotes: 1