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

USERELATIONSHIP not showing all the records

Hello,

 

I have 3 measures

This returns the number the records created on datumCallDate with a relationship with the datetable 'dwh DimDate'. Joined on DateKey and datumCallDate

 

 

Count Aangemeld callDate =
CALCULATE(
COUNT('vw_topdesk_incidenten_dt'[id]),
USERELATIONSHIP('dwh DimDate'[DateKey],vw_topdesk_incidenten_dt[datumCallDate]), FILTER('vw_topdesk_incidenten_dt','vw_topdesk_incidenten_dt'[active] ="yes")) 

 

 

This returns the number the records created on datumCompletedDate with a relationship with the datetable 'dwh DimDate'. Joined on DateKey and datumCompletedDate

 

 

Count Afgemeld completedDate =
CALCULATE(
COUNT('vw_topdesk_incidenten_dt'[id]),
USERELATIONSHIP('dwh DimDate'[DateKey],vw_topdesk_incidenten_dt[datumCompletedDate]), FILTER('vw_topdesk_incidenten_dt','vw_topdesk_incidenten_dt'[completed] = "yes" && 'vw_topdesk_incidenten_dt'[closed] = "No" && 'vw_topdesk_incidenten_dt'[active]="yes")) 

 

 

This returns the number the records created on datumClosedDate with a relationship with the datetable 'dwh DimDate'. Joined on DateKey and datumClosedDate

 

 

Count Afgesloten closedDate = 
CALCULATE( COUNT('vw_topdesk_incidenten_dt'[id]),
USERELATIONSHIP('dwh DimDate'[DateKey],vw_topdesk_incidenten_dt[datumClosedDate]), FILTER('vw_topdesk_incidenten_dt','vw_topdesk_incidenten_dt'[closed] = "yes" && 'vw_topdesk_incidenten_dt'[active]="yes"))  

 

 

I created my relationships with the datetable

RelationshipsRelationships

  

The linechart

 

LinechartLinechart

 

The line Count Aangemeld callDate is showing the right numbers but Count Afgemeld completedDate and Count Afgesloten closedDate and Count Afgesloten closedDate are not.

 

Let's look at 8/02/2021

 

userelationship_0802021.PNG

 When I do a count on my SQL table I get different numbers

userelationship_countsql.PNG

 I can't figure out why. Are my measures wrong?

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hey @jameszhang0805 ,

 

The solution was just deactivating all relationships. CallDate was active that why that number was correct

View solution in original post

3 REPLIES 3
jameszhang0805
Resolver IV
Resolver IV

Hi @Anonymous,
My friend once met this problem. We were thinking for a long time but we couldn't find the reason. Finally, my friend sent a mail to SQLBI.com, then they replied to us:
So the answer to your question is in the order of evaluations of the steps of Calculate function.
When FILTER is evaluated it still uses the active relationship. After it's been evaluated, the USERELATIONSHIP modifier is executed and when the measure is evaluated the result of the filter that was evaluated before is applied in an AND condition with the filter resulting from the USERELATIONSHIP. To overcome this issue, remove the filtering of all conditional columns with the All function, and wrap Keepfilters outside the Filter function is the safest way to keep the correct result. 
My English is poor, hope you can understand my explanation. If my solution is ok, please click to accept solution.
Thanks.
BR/James Zhang

jameszhang0805
Resolver IV
Resolver IV

I can't guarantee that it will solve the problem, but if you are willing to try

jameszhang0805_0-1613734994522.png

 

Anonymous
Not applicable

Hey @jameszhang0805 ,

 

The solution was just deactivating all relationships. CallDate was active that why that number was correct

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.

Top Solution Authors