cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MariaTomova
Regular Visitor

USERELATIONSHIP function returns all rows from table instead of only related ones

Hello,

I two relationships between two tables.
I am trying to use the inactive one in only one measure by using the USERELATIONSHIP function.

However, the result I am getting is the total number of rows in my table, when there should be much less.

 

The measure I have used looks like that:

TEST = 

CALCULATE(SUM('FNG activity'[qty]),

USERELATIONSHIP('FNG activity'[sku], 'Rear Bumpers List'[sku]))

1st table name: FNG activity (related column: sku)

2nd table name: Rear Bumpers list (1st related column and ACTIVE relationship: manufacturer sku
                                                         2nd related column and INACTIVE relationship: sku)

The value I should get is 792 and instead I am getting total number of rows in FNG activity table: 4747

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@MariaTomova , hop you are using this in measure not column ,

 

In case you do not want to include blank values in the join  then add

 

TEST =
CALCULATE(SUM('FNG activity'[qty]),
USERELATIONSHIP('FNG activity'[sku], 'Rear Bumpers List'[sku]) ,not(isblank('Rear Bumpers List'[sku])))

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

View solution in original post

2 REPLIES 2
MariaTomova
Regular Visitor

Thank you @amitchandak 

It worked perfect!

amitchandak
Super User
Super User

@MariaTomova , hop you are using this in measure not column ,

 

In case you do not want to include blank values in the join  then add

 

TEST =
CALCULATE(SUM('FNG activity'[qty]),
USERELATIONSHIP('FNG activity'[sku], 'Rear Bumpers List'[sku]) ,not(isblank('Rear Bumpers List'[sku])))

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

View solution in original post

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Top Solution Authors
Top Kudoed Authors