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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
MarlonPereira
Regular Visitor

Custom column to identify new customers

I have the following table: 

NameYear
Customer A2022
Customer A2021
Customer A2021
Customer B2022
Customer B2020
Customer C2021

 

What I want: for each row, identify if that customer is a new client (i.e. didn't have any entries on previous years). Expected output (using a custom column, don't know if there are better approaches):

 

NameYearNew?
Customer A2022No
Customer A2021Yes
Customer A2021Yes
Customer B2022No
Customer B2020Yes
Customer C2021Yes

 

I already tried COUNT and FILTER methods combined, without much success. Any sugestions?

 

Thanks!

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @MarlonPereira ,

 

Please try:

New? = 
var _a = CALCULATE(COUNT('Table'[Name]),FILTER('Table',[Name]=EARLIER('Table'[Name])&&[Year]<EARLIER('Table'[Year])))
return IF(_a>=1,"No","Yes")

Final output:

vjianbolimsft_0-1670375902168.png

Best Regards,

Jianbo Li

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

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @MarlonPereira ,

 

Please try:

New? = 
var _a = CALCULATE(COUNT('Table'[Name]),FILTER('Table',[Name]=EARLIER('Table'[Name])&&[Year]<EARLIER('Table'[Year])))
return IF(_a>=1,"No","Yes")

Final output:

vjianbolimsft_0-1670375902168.png

Best Regards,

Jianbo Li

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

Perfect, my previous attempt didn't include the EARLIER function. Thank you!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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