Forum Discussion

webportal's avatar
webportal
Impactful Individual
9 years ago
Solved

Using a Boolean expression with CALCULATE

 

Can someone explain me why this expression of a calculated measure works:

 

Measure = CALCULATE(SUM(Facts[Turnover]);FILTER('Facts';'Facts'[UnitPrice]>=50))

 Whereas this one doesn't:

 

Measure = CALCULATE(SUM(Facts[Turnover]);'Facts'[UnitPrice]>=50)

I know CALCULATE can use a Boolean expression or a table expression that defines a filter, but isn't the second expression using a Bolean condition:

'Facts'[UnitPrice]>=50

 

  • This is correct. No measure or CALCULATE expression, unless you write a full FILTER expression around it.

10 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    In what sense does the second formula "not work"? It appears to work fine in my test.

    • webportal's avatar
      webportal
      Impactful Individual

      Hello,

       

      I get the error:

       

       

       

      This means something like: "A CALCULATE function was used in a TRUE/FALSE expression as a table filter. This is not allowed".

      And this message gets me even more confused.

       

      However, the following function works perfectly:


      • Anonymous's avatar
        Anonymous
        Not applicable

        Are you adding that formula as a measure or a column?