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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

DAX to find Customer count who order exact same order list more than once in bimonthly span

Hi Team,

I need to create a DAX but not getting any logic on how to build this one. I extend my hand to my Power BI family for help. I am able to pull the customers who placed more than one order but not able to check if the items bought in an two orders are same items and quantities.

KPIs :

  • On a bi-monthly basis share of customers having more than 1 consecutive order composed by the same variants (with same qtys) 

  • Compare the above to the share of customers having more than 1 consecutive order composed by different variants (within orders)

Tables

 

Order Table (PK - Order No)

CustomerOrder noOrder Date
Customer A1237/1/2022
Customer A3217/23/2022
Customer A2318/12/2022
Customer A19818/18/2022

 

Order Items (PK No - Order No)

Order NoOrder ItemsOrder Quantity
123Matrix Serum 250 ml1
123Sunsilk Shampoo 340 ml1
123Sunsilk Conditioner 110 ml 2
321Matrix Serum 250 ml1
321Pantene Shampoo 340 ml1
231Matrix Serum 250 ml1
231Sunsilk Shampoo 340 ml1
231Sunsilk Conditioner 110 ml 2
1981Matrix Serum 250 ml1
1981Sunsilk Shampoo 340 ml1
1981Sunsilk Conditioner 110 ml 2

 

Expected Result: DAX output should provide Customer A (Count 1) because Customer A has ordered exact same order twice on 7/1/2022 and 8/12/2022

 

Please let me know if any further explanation is needed. Any help will be highly appreciable. 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

This is not super simple so let's start without considering dates.

 

You can find customers with multiple identical orders by creating a summary of customers and orders and converting the list of order items and quantities into a single string for each order. Once you have this, you can group on customers and string to see which combinations are duplicated (have a count > 1).

 

Here's my attempt at implementing this:

Customers with Repeat Orders =
VAR Summary =
    SUMMARIZE (
        OrderItems,
        Orders[Customer],
        OrderItems[Order No],
        "ItemString",
            CONCATENATEX (
                OrderItems,
                OrderItems[Order Items] & ": " & OrderItems[Order Quantity],
                "; ",
                OrderItems[Order Items]
            )
    )
VAR Grouped =
    GROUPBY (
        Summary,
        Orders[Customer],
        [ItemString],
        "Count", SUMX ( CURRENTGROUP (), 1 )
    )
VAR Repeats = SUMMARIZE ( FILTER ( Grouped, [Count] > 1 ), Orders[Customer] )
RETURN
    COUNTROWS ( Repeats )

 

To visualize this, here's what a couple of the intermediate tables look like:

 

Summary:

AlexisOlson_0-1672165187595.png

 

Grouped:

AlexisOlson_1-1672165223534.png

View solution in original post

1 REPLY 1
AlexisOlson
Super User
Super User

This is not super simple so let's start without considering dates.

 

You can find customers with multiple identical orders by creating a summary of customers and orders and converting the list of order items and quantities into a single string for each order. Once you have this, you can group on customers and string to see which combinations are duplicated (have a count > 1).

 

Here's my attempt at implementing this:

Customers with Repeat Orders =
VAR Summary =
    SUMMARIZE (
        OrderItems,
        Orders[Customer],
        OrderItems[Order No],
        "ItemString",
            CONCATENATEX (
                OrderItems,
                OrderItems[Order Items] & ": " & OrderItems[Order Quantity],
                "; ",
                OrderItems[Order Items]
            )
    )
VAR Grouped =
    GROUPBY (
        Summary,
        Orders[Customer],
        [ItemString],
        "Count", SUMX ( CURRENTGROUP (), 1 )
    )
VAR Repeats = SUMMARIZE ( FILTER ( Grouped, [Count] > 1 ), Orders[Customer] )
RETURN
    COUNTROWS ( Repeats )

 

To visualize this, here's what a couple of the intermediate tables look like:

 

Summary:

AlexisOlson_0-1672165187595.png

 

Grouped:

AlexisOlson_1-1672165223534.png

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors