Forum Discussion

Medmbchr's avatar
Medmbchr
Helper IV
3 years ago
Solved

VAR Table in RETURN statement

Hi I have created a variable in a DAX formula which returns a TABLE. However, when I try to return a value from a column in that table using SUM to sum all my columns, DAX doesn't recognize my table at all. How can I refer to a created VAR table into my RETURN statement? Thanks
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Medmbchr ,

    Please try below steps:

    1. below is my test table

    Table:

     

    2. create measure with below dax formula

     

     

    Measure =
    VAR tmp =
        FILTER ( ALL ( 'Table' ), [Column2] < 50 )
    RETURN
        SUMX ( tmp, [Column2] )
    

     

     

    3. add a card visual with above measure

    Pleae refer attached .pbix file.

     

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Medmbchr ,

    Please try below steps:

    1. below is my test table

    Table:

     

    2. create measure with below dax formula

     

     

    Measure =
    VAR tmp =
        FILTER ( ALL ( 'Table' ), [Column2] < 50 )
    RETURN
        SUMX ( tmp, [Column2] )
    

     

     

    3. add a card visual with above measure

    Pleae refer attached .pbix file.

     

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Medmbchr's avatar
      Medmbchr
      Helper IV

      I am trying to use SUMX and STDEVX.P but nothing