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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BenPo
Frequent Visitor

TTM Var Syntax Error

Hello! I'm trying to get this TTM quantity formula to work but I keep getting a syntax error for "Current Date." Any thoughts? I've tried multiple date options. I'm getting the same error on a different formula that uses this variable structure with dates. Dates are formatted e.g. 6/26/2021 12:00:00 AM

 

TTMInvoiceQty =
Var CurrentDate = MAX(DeliveryDate[LastDateOfFiscalMonth])
Var PreviousDate = Date(Year(CurrentDate),Month(CurrentDate)-12,Day(CurrentDate))
Var Result =
         Calculate(
         Sum(FactSalesInvoiceDetail[InvoiceQuantity]),
         Filter(
                 ActualDeliveryDate,
                    ActualDeliveryDate[FiscalDate] >= PreviousDate && ActualDeliveryDate[FiscalDate] <= CurrentDate)
     )
Return
Result
3 REPLIES 3
V-lianl-msft
Community Support
Community Support

Is "DeliveryDate[LastDateOfFiscalMonth]" a date formatted column?

 

Please refer to this blog to describe your problems, so that your problems can be solved faster.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523 

 

Anonymous
Not applicable

1) Is this a measure or a columns?

2) Isolate 'CurrentDate'   by putting  CurrentDate in the return.   If this is a measure, put the value in a card or muliple value card, if it is a column you will see the data in the column.  Make sure this really returning a date.  

 

Columns, I think. I isolated MAX (ActualDeliveryDate[fiscaldate]) and it returns "6/26/2021." I get the syntax error when I try to make it a variable.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors