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

Error in Measure Using USERELATIONSHIP Function

Hello,

 

I can't figure out what the problem is with the following Measure: 

 

Measure = CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[Column1]="text")), USERELATIONSHIP(table1[column2],table2[column2])

 

The Calculate/Filter portion of the measure work fine. And the USERELATIONSHIP expression works fine on its own and in other measures. It's only when I put the two together that I start seeing problems. What's the issue? 

 

Thanks for your help! 

2 ACCEPTED SOLUTIONS

Well, if the CALCULATE is closed, then what is the USERELATIONSHIP part of? It wouldn't be part of any calculation at all from what I can see in the formula. 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

You either want to drop this additional parenthesis, so that USERELATIONSHIP is included in your CALCULATE, or add another CALCULATE( before the first one.

From what you wrote, it seems you want to nest CALCULATEs, but I am not sure to understand why.

 

Edit: In the latter case, you also want to add an additional parenthis after USERELATIONSHIP(...)

 

 

View solution in original post

6 REPLIES 6
LaurentCouartou
Solution Supplier
Solution Supplier

What error message/issue do you have?

 

It seems to me you have an extra parenthesis right after your FILTER argument.

Anonymous
Not applicable

It says "The syntax for 'USERELATIONSHIP' is incorrect. 

 

WOuldn't two parentheses after Filter be correct? The first one closes the Filter argument and the second one closes the Calculate function. 

You either want to drop this additional parenthesis, so that USERELATIONSHIP is included in your CALCULATE, or add another CALCULATE( before the first one.

From what you wrote, it seems you want to nest CALCULATEs, but I am not sure to understand why.

 

Edit: In the latter case, you also want to add an additional parenthis after USERELATIONSHIP(...)

 

 

Anonymous
Not applicable

@LaurentCouartou @Greg_Deckler Thank you both! My (stupid) mistake was not inlcuding the USERELATIONSHIP function in Calculate... I was treating them as separate things. I removed the extra parenthesis and it worked fine. 

Well, if the CALCULATE is closed, then what is the USERELATIONSHIP part of? It wouldn't be part of any calculation at all from what I can see in the formula. 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

For some added context, my goal is to create a measure that counts a filtered number of rows, and once it has that count, applies a specific relationship.  

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.