Forum Discussion

arneshabobo's avatar
arneshabobo
New Member
4 years ago
Solved

New Measure Error for Current Year Sales

Hi everyone. 

 

I'm working on a new measure for current year sales. I received the following error: 

 

The syntax for 'RETURN' is incorrect. (DAX(Var CY = MAX('Date Dim'[Year]RETURNCALCULATE(SUM(Actuals[Sales Amount],'Date Dim'[Year]=CY))).

 

Here is my formula:

Line 1 CY Sales = 

Line 2 Var CY = MAX('Date Dim'[Year]

Line 3

Line 4 RETURN

Line 5 CALCULATE(SUM(Actuals[Sales Amount],'Date Dim'[Year]=CY)

Line 6

 

I'm not sure why I received this error message. 

  • arneshabobo  try this, You missed the closing Parenthesis in VAR CY

     

    CY Sales =
    Var CY = MAX('Date Dim'[Year])
    RETURN
    CALCULATE(SUM(Actuals[Sales Amount]),'Date Dim'[Year]=CY)

6 Replies

  • smpa01's avatar
    smpa01
    Icon for Community Champion rankCommunity Champion

    arneshabobo  try this, You missed the closing Parenthesis in VAR CY

     

    CY Sales =
    Var CY = MAX('Date Dim'[Year])
    RETURN
    CALCULATE(SUM(Actuals[Sales Amount]),'Date Dim'[Year]=CY)

    • arneshabobo's avatar
      arneshabobo
      New Member

      Hi! Thank you for responding. I added the parenthesis but now the error says " too many arguments were passed to the SUM function. The maximum argument count for the function is 1."

      • Anonymous's avatar
        Anonymous
        Not applicable

        HI arneshabobo 

         

         You missed the closing paranthesis for the SUM function too, pls close it, it should work.

        CALCULATE(SUM(Actuals[Sales Amount]) ,'Date Dim'[Year]=CY)

         

        Thanks
        Raj