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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Variables syntax error message

Hello, I'm trying to use variables within my measure / DAX expression however I'm getting the below error message for the below DAX expression.

 

Error Message: The report measure MeasureName has a syntax or semantic error at line 2, position 5, reported by Analysis Services: 'The syntax for PerformanceIndexMTD' is incorrect.'.

 

We're on SSAS 2014... and we have a live connection to the data model on SSAS 2014.  Could this be the issue since I'm reading that variables only became available in SSAS 2015?

 

It's confusing because some other articles read as if it's the tool that you're working on needs to either be Power BI or Excel 2016 for variables to work. https://www.sqlbi.com/blog/marco/2017/09/12/the-easiest-way-to-start-using-variables-in-dax/

 

Anyone have a clue as to what my problem is?

 

Perf - Relative - MTD 2 (Variables) = 
VAR PerformanceIndexMTD =
    CALCULATE ( SUM ( Performance[MTD] ), Performance[Account Type] = "Index" )
VAR PerformanceAccountMTD =
    CALCULATE (
        SUM ( Performance[MTD] ),
        Performance[Account Type] = "Account",
        Performance[IndexNo] = BLANK ()
    )
VAR PerformanceRelativeMTD = PerformanceAccountMTD - PerformanceIndexMTD
RETURN
    PerformanceRelativeMTD
1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi  @Anonymous,

 

I have foud that the accouncement that Var function is included in SQL Server 2016 Analysis Services (SSAS), Power Pivot in Excel 2016, and Power BI Desktop only. 

 

You could find the document here.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi  @Anonymous,

 

I have foud that the accouncement that Var function is included in SQL Server 2016 Analysis Services (SSAS), Power Pivot in Excel 2016, and Power BI Desktop only. 

 

You could find the document here.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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