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
Andrew_na_lang
Helper IV
Helper IV

Identify the customers who ordered again after our promotion

I need help. We are running a promotion and identifying how many new customers have used the promotion. 
A calculated column (Conversion) was created with a DAX Formula of: 

Conversion =
VAR _FirstOrder = Sheet1[ORDER RANK] = 1
VAR _Promo = Sheet1[First_ORDER_PROMOTION] = "Yes"

RETURN

IF( _FirstOrder && _Promo , "Converted", "")

 

 

Now, I need to create another column where I can identify who amongst the customers who were "converted" submitted another order. In this table, customers A, B, and E who were converted already had their 2nd order. I need to create a calculated column and have them tagged as converted to second.

DESIRED OUTPUT: 

Screenshot 2023-02-12 212453.png

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@Andrew_na_lang  calculated column

 

Column =
IF (
    'fact'[orderRank] = 2
        && ISBLANK (
            TOCSV (
                INDEX (
                    2,
                    ALL ( 'fact'[pickupDate], 'fact'[custID] ),
                    ORDERBY ( 'fact'[pickupDate], ASC ),
                    KEEP,
                    PARTITIONBY ( 'fact'[custID] )
                ),
                100,
                ","
            )
        )
            = FALSE (),
    "Converted to Second"
)

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

6 REPLIES 6
smpa01
Super User
Super User

@Andrew_na_lang  calculated column

 

Column =
IF (
    'fact'[orderRank] = 2
        && ISBLANK (
            TOCSV (
                INDEX (
                    2,
                    ALL ( 'fact'[pickupDate], 'fact'[custID] ),
                    ORDERBY ( 'fact'[pickupDate], ASC ),
                    KEEP,
                    PARTITIONBY ( 'fact'[custID] )
                ),
                100,
                ","
            )
        )
            = FALSE (),
    "Converted to Second"
)

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
FreemanZ
Super User
Super User

hi @Andrew_na_lang 

try like:

Convertrd to 2nd order =
VAR _ordercount = 
COUNTROWS(
    FILTER(
        TableName,
        TableName[CustomerID]=EARLIER(TableName[CustomerID])
            &&TableName[Converted]="Converted"
    )
)
RETURN
IF(_ordercount>1, "Converted to second")

@FreemanZ it didn't work

hi @Andrew_na_lang 

what do you get?

@FreemanZ  blank

Screenshot 2023-02-12 222327.png

hi @Andrew_na_lang 

try like:

Convertrd to 2nd order =
VAR _ordercount = 
COUNTROWS(
    FILTER(
        TableName,
        TableName[CustomerID]=EARLIER(TableName[CustomerID])
    )
)
RETURN
IF(_ordercount>1, "Converted to second")
 
or you would need to enrich your sample data to better reflect your challenge.

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.