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
JackEnviro
Helper I
Helper I

Categorise Orders by largest product group - shopify data

Hello

 

I have a relationship table as below. Where the Shopify Order table contains a list of all transactions at individual Sku code level. I would like to add a calculated column (I think!) that categorises each transaction by the highest value product category sale in that order. Thi aim is that each order can be attributed to a Product group for marketing ROI analysis.

 

For example: 

The first 6 transactions in the table are "Order 1", therefore look-up the product catgeory of each sku (i.e. different types of beers, beer wines, coffees) in the "StockValues" table "Group1" which define the meta cetegory, then return the product category with the highest value. So that say an order made up of lots of different drink types (e.g. Beer, Wine, Juice, Water, Coffee etc) the highest selling drink category by value is identified as "Beer" and this order can be identified as predominantly a beer order rather than a "Coffee" order.  

 

Thanks

Jack

 

 Tables.JPG

 

Relationship table.JPG

2 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

hI @JackEnviro

 

tRY THIS COLUMN

 

Column =
VAR T1 =
    SELECTCOLUMNS (
        FILTER (
            ALL ( 'Shopify Orders' ),
            'Shopify Orders'[Order] = EARLIER ( 'Shopify Orders'[Order] )
        ),
        "Group", RELATED ( StockValues[Group1] ),
        "Value", [Lineitem Price] * [Lineitem count]
    )
VAR T2 =
    SUMMARIZE ( T1, [Group], "Values", SUMX ( T1, [Value] ) )
VAR T3 =
    TOPN ( 1, T2, [Values], DESC )
RETURN
    MINX ( T3, [Group] )

Regards
Zubair

Please try my custom visuals

View solution in original post

@JackEnviro

 

Please see attached file

 

caegorize.png


Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

hI @JackEnviro

 

tRY THIS COLUMN

 

Column =
VAR T1 =
    SELECTCOLUMNS (
        FILTER (
            ALL ( 'Shopify Orders' ),
            'Shopify Orders'[Order] = EARLIER ( 'Shopify Orders'[Order] )
        ),
        "Group", RELATED ( StockValues[Group1] ),
        "Value", [Lineitem Price] * [Lineitem count]
    )
VAR T2 =
    SUMMARIZE ( T1, [Group], "Values", SUMX ( T1, [Value] ) )
VAR T3 =
    TOPN ( 1, T2, [Values], DESC )
RETURN
    MINX ( T3, [Group] )

Regards
Zubair

Please try my custom visuals

@JackEnviro

 

Please see attached file

 

caegorize.png


Regards
Zubair

Please try my custom visuals

Hi Zubair

 

That's perfect - thank you!

 

Jack

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.