Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Return Error on measure

I'm getting the below error in my measure and not sure why.  My return is being highlighted with an error.



 

 

 

  • HI Anonymous ,

     

    Can you please tag me next time with your response? (Use  sign) 🙂

     

    The issue is in the highlighted portion of the your DAX expresssion: (orange highlight)

     

    You have given an expression in the MAX function, whereas it only accepts the column as argument.

    Create a variable for the highlighted portion (GREEN highlight) as you have created above like period, the_first_date, etc.

    Then use that variable in your SWICH function in place of the highlighted portion (Green portion) and rest remains same --> your_variable = "Erythritol"

     

3 Replies

  • Hi Anonymous ,

     

    You are missing an ELSE argument in your IF statement under RETURN clause.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      It's default is blank().  Even if I add a else condition I still get the below error. 

      "Product" is a column reference so not sure why I'm getting the error.

      • Pragati11's avatar
        Pragati11
        Icon for Super User rankSuper User

        HI Anonymous ,

         

        Can you please tag me next time with your response? (Use  sign) 🙂

         

        The issue is in the highlighted portion of the your DAX expresssion: (orange highlight)

         

        You have given an expression in the MAX function, whereas it only accepts the column as argument.

        Create a variable for the highlighted portion (GREEN highlight) as you have created above like period, the_first_date, etc.

        Then use that variable in your SWICH function in place of the highlighted portion (Green portion) and rest remains same --> your_variable = "Erythritol"