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
amirabedhiafi
Impactful Individual
Impactful Individual

Find the No. of Customers that were there in the Last Year data as well as in the Current Year data

I have a small data which has two tables in it. Sales table contains the two columns, Order Date, Customer Name, and Date Table contains the Date column with two years of data (2015 and 2016). 

 

I need to find the No. of Customers that were there in the Last Year data as well as in the Current Year data. 

Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini
1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @amirabedhiafi ,

 

You can use the following measure:

 

Measure = SUMX(SUMMARIZE(Sales,Sales[Customer Name],"salesin both year",var a = CALCULATE(COUNT(Sales[Customer Name]),FILTER('Date','Date'[Date].[Year]=Year(Today()-1))) var b = CALCULATE(COUNT(Sales[Customer Name]),FILTER('Date','Date'[Date].[Year]=Year(Today())) return IF(a+b>=2,1,0)),[salesin both year])

 

Capture2.PNG

 

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

 

Best Regards,

Dedmon Dai

View solution in original post

2 REPLIES 2
v-deddai1-msft
Community Support
Community Support

Hi @amirabedhiafi ,

 

You can use the following measure:

 

Measure = SUMX(SUMMARIZE(Sales,Sales[Customer Name],"salesin both year",var a = CALCULATE(COUNT(Sales[Customer Name]),FILTER('Date','Date'[Date].[Year]=Year(Today()-1))) var b = CALCULATE(COUNT(Sales[Customer Name]),FILTER('Date','Date'[Date].[Year]=Year(Today())) return IF(a+b>=2,1,0)),[salesin both year])

 

Capture2.PNG

 

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

 

Best Regards,

Dedmon Dai

jdbuchanan71
Super User
Super User

You could count the unique customer names in your order table like so.

Customer Count = DISTINCTCOUNT ('Table 1'[Customer Name])

Then you make a visual with the year from your date table and that measure which should give you what you are looking for.

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.