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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
daniyalmazhar5
Regular Visitor

TREATAS returns blanks but USERELATIONSHIP returns values

I have 3 tables:
1) Territories
2) Doctors
3) Visits

Territories filters Doctors based on TerritoryCodes, and Doctors filters Visits based on DoctorKeys. There is an inactive relationship between Territories and Visits based on TerritoryCodes as well.

The Visits table has some DoctorKeys that are missing in the Doctors table.

I have created 3 COUNTROWS measures:

[ActualCalls] =
COUNTROWS ( 'Visits' )

[ActualCallsTREATAS] =
CALCULATE (
COUNTROWS ( 'Visits' ) ,
TREATAS ( VALUES ( 'Territories'[Territory] ) , 'Visits'[Territory] ) )

[ActualCallsUSERELATIONSHIP] =
CALCULATE (
COUNTROWS ( 'Visits' ) ,
USERLATIONSHIP ( 'Territories'[Territory] , 'Visits'[Territory] ) )

The measures give the following results:

daniyalmazhar5_0-1646069979692.png

As expected, ActualCalls show 1,266 visits against a blank row due to the missing DoctorKeys in the Doctors table. But I expected TREATAS and USERELATIONSHIP to both be able break down those calls as the Territories table contains all the territories found in the Visits table. USERELATIONSHIP does this well, but TREATAS fails to pull in the required values (but still shows the same total as the other measures).

Can anyone please help explain what's going on?


1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

First, the totals all being the same makes sense because, in the total line, there is no filtering happening related to territory. The filtering paths don't matter since they aren't being used.

 

Now, what's up with TREATAS? In this measure, the Doctors table is still filtering Visits but now you've added an additional filter on top of that. In particular, Visits is still limited to the rows that match the Doctors table (which is why you don't see the 1,266 in the blank row). If you insert ALL ( Doctors ) into the TREATAS measure, then it'll probably match the USERELATIONSHIP measure.

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

First, the totals all being the same makes sense because, in the total line, there is no filtering happening related to territory. The filtering paths don't matter since they aren't being used.

 

Now, what's up with TREATAS? In this measure, the Doctors table is still filtering Visits but now you've added an additional filter on top of that. In particular, Visits is still limited to the rows that match the Doctors table (which is why you don't see the 1,266 in the blank row). If you insert ALL ( Doctors ) into the TREATAS measure, then it'll probably match the USERELATIONSHIP measure.

Thanks Alexis!

I'd thought TREATAS would replace any existing filters and bypass existing relationships, but the ALL('Doctors') or REMOVEFILTERS('Doctors') does the trick 👍

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.