Forum Discussion

pedroccamaraDBI's avatar
pedroccamaraDBI
Icon for Post Partisan rankPost Partisan
4 years ago
Solved

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

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
  • 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

6 Replies

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

    • pedroccamaraDBI's avatar
      pedroccamaraDBI
      Icon for Post Partisan rankPost Partisan

      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

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    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. 

    • pedroccamaraDBI's avatar
      pedroccamaraDBI
      Icon for Post Partisan rankPost Partisan

      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