cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GJ217
Resolver I
Resolver I

CALCULATE and USERRELATIONSHIP not working

Hi,

 

I'm getting an error message the following error message "USERELATIONSHIP function can only be used in the CALCULATE" with the below measure I have written and I'm not sure where I have gone wrong, but I'm definately using CALCULATE and USERELATIONSHIP.

 

Leavers VOL = CALCULATE(COUNT(Person[PersonID]),

USERELATIONSHIP(Dates[Date], Person[TerminationDate])+0,

FILTER(Person,Person[TerminationReason] IN{"Resignation - VOL","Retirement - VOL"}))

 

Assistance is much appreciated

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @GJ217 
You may try it this way

Leavers VOL =
CALCULATE (
    COUNT ( Person[PersonID] ),
    USERELATIONSHIP ( Dates[Date], Person[TerminationDate] ),
    FILTER (
        Person,
        Person[TerminationReason] IN { "Resignation - VOL", "Retirement - VOL" }
    )
) + 0

View solution in original post

2 REPLIES 2
GJ217
Resolver I
Resolver I

@tamerj1 

 

Works perfectly thank you.

tamerj1
Super User
Super User

Hi @GJ217 
You may try it this way

Leavers VOL =
CALCULATE (
    COUNT ( Person[PersonID] ),
    USERELATIONSHIP ( Dates[Date], Person[TerminationDate] ),
    FILTER (
        Person,
        Person[TerminationReason] IN { "Resignation - VOL", "Retirement - VOL" }
    )
) + 0

Helpful resources

Announcements
Vote for T-Shirt Design

Power BI T-Shirt Design Challenge 2023

Vote for your favorite t-shirt design now through March 28.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.

March Events 2023A

March 2023 Events

Find out more about the online and in person events happening in March!

Top Solution Authors