Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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?
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
@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
))
User | Count |
---|---|
23 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |