Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.