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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
jfbonterra
Frequent Visitor

Running total percentage for last 30 days with inactive relationship not returning results

My formula is to count the number of records over a given period of time divided by a similar figure to get a point in time percentage. No errors with the formula but I don't return any results when I try to use an inactive relationship. Confirmed both fields in the inactive relationship are set up as one to many and both are Date types. 

 

Close Rate =
    var ClosedWon =
        CALCULATE ( COUNTROWS ( 'Opportunities' ),
            USERELATIONSHIP ( Opportunities[Close Date], 'Calendar'[Date] ),
            FILTER ( Opportunities, Opportunities[Deal Stage] in {"Closed won" } ),
            DATESINPERIOD ( 'Calendar'[Date], MAX ('Calendar'[Date]), -30, DAY ))

    var Closed = CALCULATE ( COUNTROWS ( 'Opportunities' ),
            USERELATIONSHIP ( Opportunities[Close Date], 'Calendar'[Date] ),
            FILTER ( Opportunities, Opportunities[Deal Stage] in {"Closed lost", "Closed won", "Closed – Disqualified (BDR)" }  ),
            DATESINPERIOD ( 'Calendar'[Date], MAX ('Calendar'[Date]), -30, DAY ) )
   
    var WinRate = DIVIDE ( ClosedWon, Closed )
    return WinRate
 
Any ideas why this isn't working?
 
Thanks!
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but try somethinglike below whether it suits your requirement.

 

Close Rate =
VAR ClosedWon =
    COUNTROWS (
        FILTER (
            ALL ( 'Opportunities' ),
            Opportunities[Deal Stage]
                IN { "Closed won" }
                    && Opportunities[Close Date] <= MAX ( 'Calendar'[Date] )
                    && Opportunities[Close Date]
                        >= MAX ( 'Calendar'[Date] ) - 30
        )
    )
VAR Closed =
    COUNTROWS (
        FILTER (
            ALL ( 'Opportunities' ),
            Opportunities[Deal Stage]
                IN { "Closed lost", "Closed won", "Closed – Disqualified (BDR)" }
                    && Opportunities[Close Date] <= MAX ( 'Calendar'[Date] )
                    && Opportunities[Close Date]
                        >= MAX ( 'Calendar'[Date] ) - 30
        )
    )
VAR WinRate =
    DIVIDE ( ClosedWon, Closed )
RETURN
    WinRate

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but try somethinglike below whether it suits your requirement.

 

Close Rate =
VAR ClosedWon =
    COUNTROWS (
        FILTER (
            ALL ( 'Opportunities' ),
            Opportunities[Deal Stage]
                IN { "Closed won" }
                    && Opportunities[Close Date] <= MAX ( 'Calendar'[Date] )
                    && Opportunities[Close Date]
                        >= MAX ( 'Calendar'[Date] ) - 30
        )
    )
VAR Closed =
    COUNTROWS (
        FILTER (
            ALL ( 'Opportunities' ),
            Opportunities[Deal Stage]
                IN { "Closed lost", "Closed won", "Closed – Disqualified (BDR)" }
                    && Opportunities[Close Date] <= MAX ( 'Calendar'[Date] )
                    && Opportunities[Close Date]
                        >= MAX ( 'Calendar'[Date] ) - 30
        )
    )
VAR WinRate =
    DIVIDE ( ClosedWon, Closed )
RETURN
    WinRate

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thanks! Adding the ALL filter seemed to do the trick

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.