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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Maybrick1046
Frequent Visitor

The Syntax for... is incorrect

4PBIGroup.jpg

I cannot for the life of me determine what is wrong with this statement.  Any help appreciated

5 REPLIES 5
ValtteriN
Super User
Super User

Hi,

var needs return in the end and then you can refer to the variable. 

E.g. measure = var _a = 1
return 
_a

So add: "return" and "data" and you are good

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Not working with the return
4PBIGroup1.jpg

Hi, At a quick glance it seems you are missing closing ')' from your data variable.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




There are many variables, and if you notice, in the data table itself it's not finding the field name.  Can  I hire you to help me get this right?

Hi,

The reference is greyd out if the rest of the table syntax is not working. E.g. Here I tested some similar syntax in my machine:

Measure 29 = var data =
FILTER(
SELECTCOLUMNS(ALLSELECTED('Table (15)'[Column1]),"x",'Table (15)'[Column1],"y",1),

    NOT(ISBLANK([x])) && NOT(ISBLANK([y]))
    )


var x_sum = SUMX(data,[x])
var x2 = SUMX(data,[x]^2)
var xy= SUMX(data,[x])
var row_count = COUNTROWS(data)

return 1


This works without errors:
ValtteriN_0-1674049326698.png

 







Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors