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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Calculate occurrence of store visit (first-time etc) based on date

Hi, I need help with the following:

I have ID's and date&time of store visit. I am looking for a way to calculate the columns on the right. If the ID skipps more than two months it should be again counted as first-time visitor. If you have any idea how to calculate this, please let me know. Thanks

IDdate & timefirst-time visitorrepeater (2 months in row)(one month skipped)(two months skipped)
aaa2019/11/1 14:301   
bbb2019/11/2 14:301   
ccc2019/11/2 14:301   
ddd2019/11/3 14:301   
aaa2019/12/1 14:30 1  
aaa2020/1/1 14:30 1  
bbb2020/1/2 14:30  1 
aaa2020/2/1 14:30 1  
bbb2020/2/1 14:30 1  
ccc2020/2/1 14:30   1
ddd2020/3/1 14:301   

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Create a date measure like this

last date = mixx(filter(table,table[ID] = earlier(table[ID]) && table[date] < earlier(table[date])),table[date])

if this null means first visit

datediff = datediff([last date],[date],month)

can be used to find it is continue next month or there is gap

 

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

Create a date measure like this

last date = mixx(filter(table,table[ID] = earlier(table[ID]) && table[date] < earlier(table[date])),table[date])

if this null means first visit

datediff = datediff([last date],[date],month)

can be used to find it is continue next month or there is gap

 

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

@amitchandak 

Thanks for your reply. This measure is not working for me. 

The error message says it has too many arguments for filter function. 

 

 suggested both as columns. Also share calculation that is giving error in text format

 

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors