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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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 and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.