Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
internwithquest
Frequent Visitor

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 ACCEPTED SOLUTION
internwithquest
Frequent Visitor

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

View solution in original post

1 REPLY 1
internwithquest
Frequent Visitor

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.