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
Anonymous
Not applicable

Counting number of open deals on given date

Hey guys!

 

My data look like this:

I have a date table and a sales opportunities table

Opportunitie IDCreated atClose dateOpp NameValue
35601/01/201930/06/2021Microsoft$1.000.000
35705/06/201905/10/2021Oracle$500.000
35810/11/202001/04/2021Tesla$234.000
35910/05/2021(blank)Alibaba$1.000

 

The table holds the date when the deal opportunitie is created, and when it closes (either won or lost deal). But I need a measure with the info of how many deals I have on any given date, (and other measure with how much pipeline value i have on that date) historicaly, in open deals. An open deal is a opportunitie that have already been created, but not closed yet on that given date, so it changes depending on the reference date I'm looking to. Please note close date may be blank.


Considering this, I want a column chart with a date axis, and on the other axis, the info of the open deals on each day.

Ex.: on 01/06/2021 I had 3 open deals, with a total pipeline value of $1.501.000. (I need this for all dates on my axis).

1 ACCEPTED SOLUTION
PaulOlding
Solution Sage
Solution Sage

Hi @Anonymous 

 

Here's a measure to get a count of open opportunities.  The Date table has no relationship to the Opportunities table for this.

Open Opportunities = 
VAR _Date = MAX('Date'[Date])
VAR _Result1 = 
COUNTROWS(
    FILTER(
        Opportunities,
        Opportunities[Created at] <= _Date && _Date <= Opportunities[Close date]
        )
    )
VAR _Result2 = 
COUNTROWS(
    FILTER(
        Opportunities,
        Opportunities[Created at] <= _Date && ISBLANK(Opportunities[Close date])
        )
    )
RETURN
    _Result1 + _Result2

 

The opportunity value measure can have a similar pattern, replacing the COUNTROWS with a SUMX

VAR _Result1 = 
SUMX(
    FILTER(
        Opportunities,
        Opportunities[Created at] <= _Date && _Date <= Opportunities[Close date]
        ),
    Opportunities[Value]
    )

View solution in original post

3 REPLIES 3
ValtteriN
Super User
Super User

Hi,

Here is one way to do this. 

Open deals = var _date = MAX('Calendar'[Date]) return
countx(filter(all(Deals),or(and(Deals[Close date]>_date,Deals[Created at]<=_date),
and(Deals[Close date]=BLANK(),Deals[Created at]<=_date))),[Opportunitie ID])

Open deals Value = var _date = MAX('Calendar'[Date]) return
sumx(filter(all(Deals),or(and(Deals[Close date]>_date,Deals[Created at]<=_date),
and(Deals[Close date]=BLANK(),Deals[Created at]<=_date))),[Value])
 
I hope this helps and if it deos consider accepting this as a solution!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




PaulOlding
Solution Sage
Solution Sage

Hi @Anonymous 

 

Here's a measure to get a count of open opportunities.  The Date table has no relationship to the Opportunities table for this.

Open Opportunities = 
VAR _Date = MAX('Date'[Date])
VAR _Result1 = 
COUNTROWS(
    FILTER(
        Opportunities,
        Opportunities[Created at] <= _Date && _Date <= Opportunities[Close date]
        )
    )
VAR _Result2 = 
COUNTROWS(
    FILTER(
        Opportunities,
        Opportunities[Created at] <= _Date && ISBLANK(Opportunities[Close date])
        )
    )
RETURN
    _Result1 + _Result2

 

The opportunity value measure can have a similar pattern, replacing the COUNTROWS with a SUMX

VAR _Result1 = 
SUMX(
    FILTER(
        Opportunities,
        Opportunities[Created at] <= _Date && _Date <= Opportunities[Close date]
        ),
    Opportunities[Value]
    )
amitchandak
Super User
Super User

@Anonymous , Check if this blog on the similar topic can help

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.