Forum Discussion

VVI's avatar
VVI
Frequent Visitor
3 years ago

Visual using USERELATIONSHIP

Hi all,

 

I'm trying to create a simple column chart as follow

 

with 2 tables: Calendar Date and Contract table.

I have 2 date relationships between both tables, by using Date column in Calendar Date table  with one active relationship with Contract Active Date and another inactive one with Contract End Date, from Contract table.

For this visual, I need to use Contract End Date in the DAX formula.

And I'd like to use Month column from Calendar Date, for easier interaction with other visuals.

But it's not as expected.

 

When I'm using Month from Contract End Date, the visual is correct though.

This is the DAX I used. I'm not sure which one is wrong, and hope to get help.

Value of Contract Expected to be Ended =
var _CurrentProdDate =
    CALCULATE(
        MAXX(
            Production,
            Production[Date]
            ),
        ALL( 'Calendar Date'[Date] ),
        Production[Status]
            = "Being Processed"
    )

var _ContractToBeEnded =
    SUMX (
        VALUES ( Contract[Customer] ),
        CALCULATE (
            MAX ( Contract[Annual Contract Value] ),
            'Calendar Date'[Date]
                >= _CurrentProdDate,
            USERELATIONSHIP (
                Contract[Contract End Date],
                'Calendar Date'[Date]
            )
        )
    )

return
    _ContractToBeEnded
 
Appreciate any help please.
 
Regards,
VVI

6 Replies

    • VVI's avatar
      VVI
      Frequent Visitor

      Hi lbendlin 

       

      Thanks for the reminder.

      Here's the data of source table.

       

      CustomerAnnual Contract ValueActive DateContract Start DateContract End Date
      Cust A                          40,00031-Dec-191-Mar-1828-Feb-23
      Cust A                          50,00031-Dec-201-Mar-1828-Feb-23
      Cust A                          55,00031-Dec-211-Mar-1828-Feb-23
      Cust A                          60,00031-Dec-221-Mar-1828-Feb-23
      Cust A                          75,00028-Feb-231-Mar-1828-Feb-23
      Cust B                          75,00031-Dec-191-Jun-1931-May-22
      Cust B                          75,00031-Dec-201-Jun-1931-May-22
      Cust B                          50,00031-Dec-211-Jun-1931-May-22
      Cust B                          50,00031-May-221-Jun-1931-May-22
      Cust C                          10,00031-Dec-211-May-2130-Apr-23
      Cust C                          15,00031-Dec-221-May-2130-Apr-23
      Cust C                          15,00030-Apr-231-May-2130-Apr-23
      Cust D                          25,00031-Dec-221-Sep-2231-Aug-24
      Cust D                          50,00031-Dec-231-Sep-2231-Aug-24
      Cust D                          50,00031-Aug-241-Sep-2231-Aug-24

       

      And the result expected in table view

       

      MonthValue of Contract Expected to be Ended
      2023-0275000
      2023-0415000
      2024-0850000
      • lbendlin's avatar
        lbendlin
        Icon for Super User rankSuper User

        What is the importance of Contract Start Date?  Is it part of the issue?

         

        how are you amortizing the annual contract value over the months?  Or is that not important?

         

        Is this what you are looking for?