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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Mehal1996
Helper II
Helper II

Conversion Rate - Start Date vs Close Date within a period - rolling

Hi there,

 

I have a data set which includes a set of records where each has a Start Date and a Close Date. I would like to count the number of records which have a Start Date that falls within the first 6-months of an 8-month period prior to the Current Date (today). Once this count is obtained, I then want to also count how many of those records identified have a Close Date that falls within the last 2-months of that same 8-month period. From both of these counts, a conversion rate should then be calculated. 

 

I've created the image below which may help to visualise the support needed in helping to create this. This window is moving, so tomorrow the conversion rate may change depending on how the data has adapted as part of the resfresh. 

 

Mehal1996_0-1667468583893.png

 

From a data perspective, my data is as simple as the Table below and also each date column is linked to it's own seperate Calendar Table. Any help is appreciated on this, thanks.

 

IDStart DateClose Date
103/09/202201/11/2022
221/07/202203/12/2022
308/06/202205/10/2022
407/07/202224/09/2022
509/09/202211/11/2022
3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @Mehal1996 ,

I add some data:

vyangliumsft_0-1667550156173.png

Here are the steps you can follow:

1. Create measure.

Count the start date =
var _today=TODAY()
var _last6date=
DATE(
    YEAR(_today),MONTH(_today)-6,DAY(_today))
var _interval=
SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Start Date]>=_last6date&&'Table'[Start Date]<=_today),"date",[Start Date])
return
COUNTX(FILTER(ALL('Table'),'Table'[Start Date] in _interval),[ID])
Count the Close date =
var _today=TODAY()
var _next2date=
DATE(
    YEAR(_today),MONTH(_today)+2,DAY(_today))
var _interval=
SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Close Date]>=_today&&'Table'[Close Date]<=_next2date),"date",[Close Date])
return
COUNTX(FILTER(ALL('Table'),'Table'[Close Date] in _interval),[ID])

2. Result:

vyangliumsft_1-1667550156174.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Hi Liu Yang, 

 

Thanks for the response. Really appreciate you looking into this. 

 

This works for the most part, however, theres no guarantee that the count of IDs that fall within the first 6 months (for start date) are only the ones that are considered for the count of IDs that fall within the last 2 months (for close date) of the rolling window (8 months window in total)

I applied your measures and the count of IDs that fall within the last 2 months (for close date) is coming out as 4 when it should be 3 after doing a manual check. I believe the 4th ID count is being counted as it has a close date within the last 2 months period, however, it doesn't have a start date within the first 6 months period. 

 

Thanks. 

amitchandak
Super User
Super User

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.