Forum Discussion

internwithquest's avatar
internwithquest
Frequent Visitor
2 years ago
Solved

The syntax for ')' is incorrect

I am using the following DAX formula to try and calculate the total earnings of last month one year prior to now:

 

Rev Last Month Last Year =
VAR LatestDate = MAX(OrderHead[InvoicePeriodDate])
VAR PrevYear = YEAR(LastDate) - IF(MONTH(LastDate) = 1, 1, 0)
VAR PrevMonth = IF(MONTH(LastDate) = 1, 12, MONTH(LastDate) - 1)
VAR Result = CALCULATE(SUM(OrderHead[CustomerTotal]), YEAR(OrderHead[InvoicePeriodDate]) = PrevYear, MONTH(OrderHead[InvoicePeriodDate]) = PrevMonth)
RETURN Result
 
This gives me the error "The syntax for ')' is incorrect.". 
 
What am I missing here?

1 Reply

  • Found my error, my variable name is not the same when I call it