Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

DAX query

Hi all,   This is the DAX query I have written.   Value = var m = (calculate(SUM('Table'[A]),FILTER('Table','Table'[B] = "0")))   But I still get an error, The syntax for ')' is incorrect. I a...
  • danextian's avatar
    4 years ago

    Hi Anonymous ,

     

    When using VAR, RETURN is required to return the final value/formula you want. You can write your formula as below

    Value =
    VAR m =
         CALCULATE ( SUM ( 'Table'[A] ), FILTER ( 'Table', 'Table'[B] = "0" ) ) 
    RETURN
        m

     

    or simply 

    Value =
    CALCULATE ( SUM ( 'Table'[A] ), FILTER ( 'Table', 'Table'[B] = "0" ) )

     

    By the way in case you are not aware 0 is different from "0" as the latter (in double quotes) is a text string.