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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply

Refinement of CALCULATE measures with USERELATIONSHIP, to include FILTER & DISTINCTCOUNT

Hi folks, I'm hoping someone can help. I have the below measure that I'm using the count total incidents using an inactive relationship:

 

INACTIVE_Count of Incidents created = CALCULATE ( COUNTA ('incidents'[Created By - Name] ), USERELATIONSHIP ('users'[Name], 'incidents'[Created By - Name] ) )

 

I'd like to re-use this measure with it's CALCULATE wraparound to create two new measures, with the below changes:

 

For the first measure:

 

  • Instead of a COUNTA of 'incidents'[Created By - Name], it should be a DISTINCTCOUNT of 'deflections'[Viewed]
  • I need to filter out results from a 'deflections'[user] column so that it only includes "string1" strings

For the second measure:

  • Instead of a COUNTA of 'incidents'[Created By - Name], it should be a DISTINCTCOUNT of 'deflections'[Viewed]
  • I need to filter out results from a 'deflections'[user] column so that it doesn't include "string2" or "string3" strings

I'm having trouble figuring out how to use FILTERs and DISTINCTCOUNTs in an inactive relationship, so any help would really be appreciated 🙂

1 ACCEPTED SOLUTION
DataZoe
Microsoft Employee
Microsoft Employee

@MichaelHutchens You could try this approach:

 

Measure1 =
CALCULATE (
DISTINCTCOUNT ( 'deflections'[Viewed] ),
USERELATIONSHIP ( 'users'[Name], 'incidents'[Created By - Name] ),
'deflections'[user] = "string1"
)

 

Measure2 =
CALCULATE (
DISTINCTCOUNT ( 'deflections'[Viewed] ),
USERELATIONSHIP ( 'users'[Name], 'incidents'[Created By - Name] ),
NOT ( 'deflections'[user] IN { "string2", "string3" } )
)

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

View solution in original post

1 REPLY 1
DataZoe
Microsoft Employee
Microsoft Employee

@MichaelHutchens You could try this approach:

 

Measure1 =
CALCULATE (
DISTINCTCOUNT ( 'deflections'[Viewed] ),
USERELATIONSHIP ( 'users'[Name], 'incidents'[Created By - Name] ),
'deflections'[user] = "string1"
)

 

Measure2 =
CALCULATE (
DISTINCTCOUNT ( 'deflections'[Viewed] ),
USERELATIONSHIP ( 'users'[Name], 'incidents'[Created By - Name] ),
NOT ( 'deflections'[user] IN { "string2", "string3" } )
)

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors