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
pedroccamaraDBI
Post Partisan
Post Partisan

userelationship

Hello everyone. I hope everyone's ok

I want to sum comercial anual from contracts table by seller in a chosen periode.
It should be simples using USERELATIONSHIP function cose in my model the dates table is not actively connected with contracts.
Here's my model
apagarpbi.JPG
my (doesn't work measure which i don't know why) measure is like this:

Comercial anual =
CALCULATE(
SUM( Contract[Comercial Anual]),
USERELATIONSHIP( Contract[Data início risco], Dates[Date] ))
The result is a unique total for each seller.
Can anyone help me please?
Thank you all
The seller column is in contract seller table
1 ACCEPTED SOLUTION

Hello @tamerj1 
This report has none filters or rows or columns anything related to dates.
About my request, do you have any suggestion on how to do this measure?
Thanks

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

@pedroccamaraDBI 

Because once you activate that relationship there will be two date filters subjected on the 'Contracts' table. One is comming directly from date table and the other one from the date table but through the Documents table. This will confuse the engine the results are usually unexpected and difficult to explain. 

Hello @tamerj1 
This report has none filters or rows or columns anything related to dates.
About my request, do you have any suggestion on how to do this measure?
Thanks

AlexisOlson
Super User
Super User

Can you show what you mean by "doesn't work"? What are you currently getting and what do you expect to get?

Hello @AlexisOlson 
Thank you for replying. I'm not an expert on DAX, far from it, but i came up with this solution by trying and trying:

Comercial anual =
CALCULATE(
SUM( Contract[Comercial Anual]), VALUES('Contract Seller'),
TREATAS( VALUES('Contract Seller'[ContractID]), Document[ContractID] ))

1st question : can you explain this measure?
Now i need to create a measure with distinctcount all contractsID and this is the measure that it's not working. It shows me 3 instead of 2. Maybe if i understood what this measure means....
Can you help?
Thanks a lot

I don't think I have enough information to give a good answer. It's difficult for me to understand what you're trying to do without seeing any underlying data and what result you're expecting based on that data.

 

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Hello @AlexisOlson 
I am very sorry to say but my data is kinda sensitive.
Let me give you a better explanation of what i need:
Remember my model up there, where i show in my model that my contract seller table as a many to one relation with contracts.
Then, i want a distinctcount of all contracts, by a specific seller name and a typeseller, which is in the matrix and in a filter box, respectively. In this matrix visual there's other fields from contracts, like cost center and Age contract for example. There's not any date filter although this contracts table is connected with dates table with an inactive connection.
This is my table
apagar.JPG
In my report, matrix, for Person1 AS A SELLER (selected already in the filter box) there are only 3 contracts, each one with its age contract, 2 contracts >3 month and 1 contract >6 month. Another example to have a proper distinctcount, Person2 has only 1 contract as a seller,as well as Person 3. But if my filter change from Seller to Manager, i will have 2 contracts for Person1, 1 for Person2, another for Person3 and none for Person4.
I hope you can help me with this explanation.
Thank you very much

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.

Top Solution Authors