Forum Discussion
SUM with multiple Filters and USERELATIONSHIP
I have a simple transactional table that has an inactive relation to our calendar.
Now I would like to get the SUM of a specific column based on two conditions/ filters that also use USERELATIONSHIP.
This is my original function without USERELATIONSHIP:
SUM =
CALCULATE (
SUM ( 'Sales'[Quantity] ),
FILTER (
'Sales',
'Sales'[Type] = 4
&& 'Sales'[Quantity] > 1
)Adding USERELATIONSHIP is not that simple because it is not working:
SUM =
CALCULATE (
SUM ( 'Sales'[Quantity] ),
FILTER (
'Sales',
'Sales'[Type] = 4
&& 'Sales'[Quantity] > 1
), USERELATIONSHIP( 'Sales'[Date], 'Calendar'[Date])
What should I change here?
2 Replies
- amitchandak
Super User
joshua1990 , It should have worked. Try with this modification
SUM =
CALCULATE (CALCULATE (
SUM ( 'Sales'[Quantity] ), USERELATIONSHIP( 'Sales'[Date], 'Calendar'[Date])),
FILTER (
'Sales',
'Sales'[Type] = 4
&& 'Sales'[Quantity] > 1
)) - AnonymousNot applicable
What error are you getting? If you are using the exact formula which you posted with USERELATIONSHIP(), you have missed a closing parenthesis in the end. Try putting a closing parenthesis in the end and try again.
Regards,
Aditya