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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.