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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
lavdeepk
Resolver I
Resolver I

How identify Repeat customers useing dax formula

Hi All,

 

I need your help to identify ( Create calculated column ) Repeat customers based on the previous year's data using the DAX formula. For example, if FY -21 customers exist in FY 20 then they should be marked, Repeat customers. sharing below sample data along with desired output.

 

FYCustomer IdCollection ValueStatus (desired output.)
FY-20CUST-1050205184593 
FY-20CUST-1050588131330 
FY-20CUST-1025818108236 
FY-20CUST-829412128024 
FY-20CUST-1052190150436 
FY-20CUST-1049227139166 
FY-21CUST-1050588101293Repeat customers 
FY-21CUST/726341151588New customers
FY-21CUST/3129337119089New customers
FY-21CUST-582722131873New customers
FY-21CUST-556614190449New customers
FY-21CUST-829412112782Repeat customers 
2 ACCEPTED SOLUTIONS
CNENFRNL
Community Champion
Community Champion

 

Result = 
IF(
    ISEMPTY(
        FILTER(
            CRM,
            CRM[Customer Id] = EARLIER( CRM[Customer Id] )
                && CRM[Index] < EARLIER( CRM[Index] )
        )
    ),
    "New",
    "Repeat"
)

 

Screenshot 2021-06-27 223924.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

Jihwan_Kim
Super User
Super User

Picture1.png

 

Status CC =
VAR currentFY =
INT ( RIGHT ( 'Table'[FY], 2 ) )
RETURN
IF (
'Table'[Customer Id]
IN SELECTCOLUMNS (
FILTER ( 'Table', INT ( RIGHT ( 'Table'[FY], 2 ) ) < currentFY ),
"@customerID", 'Table'[Customer Id]
),
"Repeat customers",
"New customers"
)

 

https://www.dropbox.com/s/sceqafezp50byap/lavdeepk.pbix?dl=0 

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Picture1.png

 

Status CC =
VAR currentFY =
INT ( RIGHT ( 'Table'[FY], 2 ) )
RETURN
IF (
'Table'[Customer Id]
IN SELECTCOLUMNS (
FILTER ( 'Table', INT ( RIGHT ( 'Table'[FY], 2 ) ) < currentFY ),
"@customerID", 'Table'[Customer Id]
),
"Repeat customers",
"New customers"
)

 

https://www.dropbox.com/s/sceqafezp50byap/lavdeepk.pbix?dl=0 

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


@Jihwan_Kim @CNENFRNL 

Both solutions working fine for me. Thanks for great help

 

Thanks

Lavdeep

CNENFRNL
Community Champion
Community Champion

 

Result = 
IF(
    ISEMPTY(
        FILTER(
            CRM,
            CRM[Customer Id] = EARLIER( CRM[Customer Id] )
                && CRM[Index] < EARLIER( CRM[Index] )
        )
    ),
    "New",
    "Repeat"
)

 

Screenshot 2021-06-27 223924.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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