cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ThomasWeppler
Helper I
Helper I

Syntax error when add multiple colums

Hi,

I try to create a new table with multiple new colums, but I get a syntax error.
When I Ctrl+X Ctrl+V the last lines of code and swift the positions of the two filters the later will not work anymore, while the first one starts to work.

syntax error.png

Does anyone know where I made the mistake?

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @ThomasWeppler  ,

You can change the Dax function after Return to try the following sub-functions:

Var x2=
Filter(
ADDCOLUMNS(x1,”total estimate”,[Estimate hours] + [Sub assignment estimate] ),
[ Sub assignment estimate] <> BLANK())
Return
filter(
ADDCOLUMNS ( x2,”total Registration”,[Registered hours] + [Sub assignment registration]),
[Sub assignment registration] <>BLANK())

 

Best Regards,

Liu Yang

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

5 REPLIES 5
TarunSharma
Resolver III
Resolver III

Hello @ThomasWeppler 
Please check the below codes and change the table and measures accordingly.
Summarized table =
VAR x1 =
SUMMARIZE (
'Recordings',
'Recordings'[ID],
'Recordings'[Actor],
Recordings[Hour],
"Estimate hours", DIVIDE ( Recordings[Hour], 60 ),
"Registered hours", DIVIDE ( Recordings[Hour], 60 ),
"Sub assignment estimate",
DIVIDE (
SUMX (
FILTER ( ALL ( Recordings ), Recordings[Hour] = EARLIER ( Recordings[Hour] ) ),
Recordings[Hour]
),
60
),
"Sub assignment registration",
DIVIDE (
SUMX (
FILTER ( ALL ( Recordings ), Recordings[Hour] = EARLIER ( Recordings[Hour] ) ),
Recordings[Hour]
),
60
)
)
VAR x2 =
FILTER (
ADDCOLUMNS (
x1,
"total estimate", [Estimate hours] + [Sub assignment estimate]
),
[Sub assignment estimate] <> BLANK ()
)
VAR x3 =
FILTER (
ADDCOLUMNS (
x1,
"total Registration", [Registered hours] + [Sub assignment registration]
),
[Sub assignment registration] <> BLANK ()
)
RETURN
UNION ( x2, x3 )

v-yangliu-msft
Community Support
Community Support

Hi  @ThomasWeppler  ,

You can change the Dax function after Return to try the following sub-functions:

Var x2=
Filter(
ADDCOLUMNS(x1,”total estimate”,[Estimate hours] + [Sub assignment estimate] ),
[ Sub assignment estimate] <> BLANK())
Return
filter(
ADDCOLUMNS ( x2,”total Registration”,[Registered hours] + [Sub assignment registration]),
[Sub assignment registration] <>BLANK())

 

Best Regards,

Liu Yang

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

TarunSharma
Resolver III
Resolver III

Hello @ThomasWeppler 

Check your second last filter end bracket.

amitchandak
Super User IV
Super User IV

@ThomasWeppler , Can you please share formula in text format. I think some paranthesis are misplaced



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Sure

 

Summarized table =
VAR x1 =
SUMMARIZE (
'2891_assignment',
'2891_assignment'[assignmentNumber],
'2891_assignment'[deadline],
'2891_assignment'[estimate],
'2891_assignment'[startdate],
'2891_assignment'[timeusage],
"Estimate hours",
DIVIDE('2891_assignment'[estimate], 60),
"Registered hours",
DIVIDE('2891_assignment'[timeusage], 60),
"Sub assignment estimate",
DIVIDE(
SUMX (
FILTER ( ALL ( '2891_assignment' ), [Underopgver] = EARLIER ( '2891_assignment'[assignmentNumber] ) ),
[estimate]
), 60),
"Sub assignment registration",
DIVIDE(
SUMX (
FILTER ( ALL ( '2891_assignment' ), [Underopgver] = EARLIER ( '2891_assignment'[assignmentNumber] ) ),
[timeusage]
), 60)
)
RETURN
FILTER (
ADDCOLUMNS ( x1, "total estimate", [Estimate hours] + [Sub assignment estimate]),
[Sub assignment estimate] <> BLANK ()
)
FILTER (
ADDCOLUMNS ( x1, "total Registration", [Registered hours] + [Sub assignment registration]),
[Sub assignment registration] <> BLANK ()
)

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

April Update

Check it Out!

Click here to read more about the April 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

secondImage

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.