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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
joyhackett
Helper II
Helper II

First time visitors this year vs last year

Thanks to another post, I was able to figure out how to get a count of members who visited for the first time in the selected date range.

 

Now, I am looking to compare that count with the number of first time visitors from the previous year.

 

I was hoping it would be easy to just put a DATEADD on the currentDate VAR, but I run into syntax errors.

 

Does anyone have any ideas on how to get last year's first time visitors?

 

This is the DAX to retrieve the current count:

(fact_branch_checkin_inc has all 9.2B visit records with the durable_member_key)

 

 

New visitors LY = 

VAR currentMembers = VALUES(fact_branch_checkin_inc[durable_member_key])
VAR currentDate = MIN(dim_date[full_date])

VAR pastMembers = CALCULATETABLE(VALUES(fact_branch_checkin_inc[durable_member_key]), 
    ALL(dim_date[full_date].[Month],dim_date[full_date].[MonthNo],dim_date[full_date].[Year])
    , dim_date[full_date]< currentDate)

VAR newCustomers = EXCEPT(currentMembers,pastMembers)

RETURN COUNTROWS(newCustomers)

 

 

 

Thanks in advance!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@joyhackett ,

first time mean, the person did not came last year ?

 

New customer is the one you are looking  for

 

YTD = calculate([Sales],datesytd('Date'[Date]))
LYTD = calculate([Sales],DATESYTD(DATEADD('Date'[Date],-1,MONTH)))
Lost Customer= Sumx(VALUES(Customer[Customer Id]),if(ISBLANK([MTD]) && not(ISBLANK([LMTD])) , 1,BLANK()))
New Customer= sumx(VALUES(Customer[Customer Id]), if(ISBLANK([LMTD]) && not(ISBLANK([MTD])) ,1,BLANK()))
Retained Customer= if(not(ISBLANK([MTD])) && not(ISBLANK([LMTD])) , 1,BLANK())

 

 

Also refer if needed

Customer Retention Part 1:
https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/b...
Customer Retention Part 2: Period over Period Retention :https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retenti...

View solution in original post

2 REPLIES 2
joyhackett
Helper II
Helper II

Thank you!

amitchandak
Super User
Super User

@joyhackett ,

first time mean, the person did not came last year ?

 

New customer is the one you are looking  for

 

YTD = calculate([Sales],datesytd('Date'[Date]))
LYTD = calculate([Sales],DATESYTD(DATEADD('Date'[Date],-1,MONTH)))
Lost Customer= Sumx(VALUES(Customer[Customer Id]),if(ISBLANK([MTD]) && not(ISBLANK([LMTD])) , 1,BLANK()))
New Customer= sumx(VALUES(Customer[Customer Id]), if(ISBLANK([LMTD]) && not(ISBLANK([MTD])) ,1,BLANK()))
Retained Customer= if(not(ISBLANK([MTD])) && not(ISBLANK([LMTD])) , 1,BLANK())

 

 

Also refer if needed

Customer Retention Part 1:
https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/b...
Customer Retention Part 2: Period over Period Retention :https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retenti...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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