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
MichaelHutchens
Helper IV
Helper IV

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
Employee
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
Employee
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
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.