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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
michaelsh
Kudo Kingpin
Kudo Kingpin

Unified Customer ID - help with algorithm

Hello friends,

I have a dataset of over-phone purchases.

Each customer can call from different phone numbers and also pay with different credit cards.

I want to build an algorithm that "unites" all connected deals into one "United Customer ID", that can be for example the minimum of a credit card.

In the attached file for example, since there are only two unified customers.

Credir card 555555 is connected to 444444, 444444 is connected to 333333 and 333333 is connected to 111111 by phones, so all of them will get ID = 1111111

I feel that I need to to a self-join, but there can be several-steps connections as in the example.

Please help.

https://1drv.ms/x/s!AoP_9ampPIT7gaAdREap9NScHrEDUw?e=2fOI2G

 

michaelsh_0-1634819312262.png

 

3 REPLIES 3
Anonymous
Not applicable

Hi @michaelsh ,

I created a sample pbix file(see attachment), please check whether that is what you want.

1. Create a calculated column as below to get the previous credit card

 

Precredit card = 
VAR _tab =
    CALCULATETABLE (
        VALUES ( 'Table'[Phone] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Credit Card] = EARLIER ( 'Table'[Credit Card] )
        )
    )
RETURN
    MINX (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Phone] IN _tab ),
        [Credit Card]
    )

 

2. Create a calculated column as below to get the min credit card

United Customer = PATHITEM ( PATH ( 'Table'[Credit Card], 'Table'[Precredit card] ), 1, INTEGER)

yingyinr_0-1635131505224.png

Best Regards

Thanks Rena, but I don't think it is working.

I've added some numbers, and the algorithm misses. please see the picture below

michaelsh_0-1635223963381.png

 

michaelsh
Kudo Kingpin
Kudo Kingpin

Anyone?

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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