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
texmexdragon2
Helper V
Helper V

USERELATIONSHIP issue

Hello Community  -  I'm confused as to why I am not seeing the results I expected.  

 

I have a dim date table and a salesforce opportunity table.   I have an active relationship between close date, and an inactive one with customer requested ship date.     I want to sum up the opportunity value of ONLY the open opportunities, but based on the customer requested ship date (which has an inactive relationship with the date table).   Per below. 

 

I had thought that by using the date table columns (Month and Year for example) in a table, and then adding this measure, that I would get back results that matched the requested ship date months.   Instead, all I am getting back are dates that match the same time frame as the closed date (the active relationship).   See example below. 

 

Doesn't the additon of the "userelationship" function overide this behavior?   If I use the actual "requested ship date" column by itself, I get the correct results, but again, I thought I could just go ahead and use the date table and have the correct results returned since the formula accounts for inactive relationship.  

 

Value of Open Opportunities =
CALCULATE (
    [Sum of Tech Amount Converted],
    USERELATIONSHIP(Sf_Opportunity[Customer_Requested_Ship_Date__c],'Dim_Date Table'[Date]),
    FILTER (
        Sf_Opportunity,
        Sf_Opportunity[Status__c] = "Open"
    )
)

 

 

texmexdragon2_1-1680707330854.png

 

 

 

texmexdragon2_0-1680706686292.png

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

I think the problem is that the FILTER argument is being calculated before the REMOVEFILTERS is applied, so the only rows which will be visible are the ones which match the date using the active relationship.

Try

Value of Open Opportunities =
CALCULATE (
    [Sum of Tech Amount Converted],
    USERELATIONSHIP ( Sf_Opportunity[Customer_Requested_Ship_Date__c], 'Dim_Date Table'[Date] ),
    Sf_Opportunity[Status__c] = "Open"
)

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

I think the problem is that the FILTER argument is being calculated before the REMOVEFILTERS is applied, so the only rows which will be visible are the ones which match the date using the active relationship.

Try

Value of Open Opportunities =
CALCULATE (
    [Sum of Tech Amount Converted],
    USERELATIONSHIP ( Sf_Opportunity[Customer_Requested_Ship_Date__c], 'Dim_Date Table'[Date] ),
    Sf_Opportunity[Status__c] = "Open"
)

@johnt75    Fantastic...that worked perfectly.  

I might add for those that see this post that the formula I orginally used was created by ChatGPT 3.5.   And even after telling it several times that I was not getting the correct results, and explaining the problem, it still was apparently not able to correct it.    

amitchandak
Super User
Super User

@amitchandak   Thanks Amit.   Fortunately the solution was much simpler and solved by the other poster.  

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