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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.