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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
apmulhearn
Helper III
Helper III

Need Help Identifying Repeat Clients Over Dynamic Time Period

Hello,

 

I am trying to calculate the percentage of new bookers vs repeat bookers.

Our variable driving date is the "First Payment Date."  So I need the calculation to adjust as the First Payment Date Range changes.

 

The way we know a guest has travelled before is based on their End Date.

 

The question I want to answer is, for All First Payments Received between X/XX/XXXX - X/XX/XXXX, how many clients had already completed AT LEAST one trip?

 

Using this small sample, if the First Payment Date Range were 9/1/2017 - 9/1/2019, only the rows in blue would be eligible, and my answer would be 1. Client ID 98076 MADE a booking in my queried range and completed 2 already.  

 

So I guess I need a DISTINCTCOUNT of Client IDs which, over a given FIRST PAYMENT DATE range, have End Dates in other rows which are PRIOR TO the dates in the FIRST PAYMENT DATE range.



ClientIDEnd DateTrip CodeStatusFirst Payment Date
123451/1/2017XA908Completed3/17/2016
123452/18/2021BA807Completed7/1/2020
123455/11/2023XA908Booked6/1/2021
123454/1/2015SA306Completed3/1/2014
980766/10/2018FA432Completed9/23/2017
980764/3/2019BA999Completed7/17/2018
980764/3/2020BA346Completed6/7/2019
43562/20/2020SA456Completed8/3/2019
1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @apmulhearn 

 

First create a calendar table

Calendar = 
var _min=MIN('Table'[First Payment Date])
var _max=MAX('Table'[First Payment Date])
return
CALENDAR(_min,_max)

then create two measures.

_isResult = 
var _payInRange=MAX('Table'[First Payment Date])in DATESBETWEEN('Calendar'[Date],MIN('Calendar'[Date]),MAX('Calendar'[Date]))
var _endInRange=MAX('Table'[End Date])in DATESBETWEEN('Calendar'[Date],MIN('Calendar'[Date]),MAX('Calendar'[Date]))
var _if=IF(_payInRange&&_endInRange,1,0)
return
    _if
_distinctcountID = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[ClientID] ),
    FILTER ( ALL ( 'Table' ), [_isResult] = 1 )
)

so we can show it with a card visual.

Result:

vangzhengmsft_0-1627021788030.png

Please refer to the attachment below for details

 

 

Hope this helps.

 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-angzheng-msft
Community Support
Community Support

Hi, @apmulhearn 

 

First create a calendar table

Calendar = 
var _min=MIN('Table'[First Payment Date])
var _max=MAX('Table'[First Payment Date])
return
CALENDAR(_min,_max)

then create two measures.

_isResult = 
var _payInRange=MAX('Table'[First Payment Date])in DATESBETWEEN('Calendar'[Date],MIN('Calendar'[Date]),MAX('Calendar'[Date]))
var _endInRange=MAX('Table'[End Date])in DATESBETWEEN('Calendar'[Date],MIN('Calendar'[Date]),MAX('Calendar'[Date]))
var _if=IF(_payInRange&&_endInRange,1,0)
return
    _if
_distinctcountID = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[ClientID] ),
    FILTER ( ALL ( 'Table' ), [_isResult] = 1 )
)

so we can show it with a card visual.

Result:

vangzhengmsft_0-1627021788030.png

Please refer to the attachment below for details

 

 

Hope this helps.

 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors