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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
GQ
Helper I
Helper I

The syntax for ')' is incorrect.

I've searched for this and the typical suggestion is that the Return is needed.  I'm using this in a new column, does it need to be a measure?  What is the issue?  I need to have a few of these but figured I'd get one right first.

 

GQ_0-1674232000877.png

 

11 REPLIES 11
tamerj1
Super User
Super User

Hi @GQ 

which column from that table would you like to return? What is the relationship between the two tables?

I want to return the 1st column which is a member number.  It is unique and it linked to another table by that number.  Essentially, if the member is not in that table, I need to concatenate another literal to a message column.  (see my reply to unicorn in this thread with my needed logic.)

tamerj1
Super User
Super User

Hi @GQ 

which column from that table would you like to return? What is the relationship between the two tables?

GQ
Helper I
Helper I

I got a new error.

GQ_0-1674233149946.png

@AnthonyJoseph - the link did not work

@unicorns 

Hi GQ, 

 

I just read your post again and if you are trying to use this in a 'new column' then it should be a measure. I think that formula is returning an entire table, which you can't use for a column since it's returning multiple columns. 

 

you should assign your code to a measure in this case. I think you can use filters+aggregate functions in your code to ensure you are returning a measure instead of entire table. let me know if I can help. 

I'm getting the same error as a measure.

Are you able to share a pbi file or information/logic on what kind of measure you are trying to create for that new column?

I created another post yesterday, I think, that may help you understand where I'm going.  It said (with notations added now):

I need to have a result column in my report be a concatenation of text and conditionally, 1 or 2 addtional text 'values'.

Donor+xxxx - in every row
conditionally, if donor # from table 1 matches a donor # from table 2, I need to concatenate "+yyy" - this would be CHAG
Further, if the State in another table = a certain value, additional concatenate "+zzz'  This, I was hoping would be another var situation.

Both the yyy & zzz are optional

End results could be any of:
Donor+xxxx
Donor+xxxx+yyy
Donor+xxxx+zzz
Donor+xxxx+yyy+zzz

yyy and zzz are not present in any table, just text values to concatenate.

@AnthonyJoseph  - I got it to work from the email I received.

unicorns
Helper II
Helper II

Hi GQ, 

Can you try returning the variable you have created? 

 

TestReq = 

var CHAG = RELATEDTABLE(CHAGAS)

RETURN CHAG

 

You can define a variable in any DAX expression by using VAR followed by RETURN. In one or several VAR sections, you individually declare the variables needed to compute the expression; in the RETURN part you provide the expression itself (Source: SQLPBI)

 

Let me know if you have any questions.

If this solves your issues, please mark it as the solution, and Kudos 👍 are very much appreciated!

- YJ

AnthonyJoseph
Resolver III
Resolver III

Hi @GQ  Return funtion consumes variables. 

TestReq = 

var Chag = Relatedtable(CHAGAS)

Return 
Chag

 

This solution might help you to understand better https://community.powerbi.com/t5/Desktop/How-DAX-Execute-VAR-RETURN/m-p/654960 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Top Solution Authors