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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register 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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.