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
Broeselchen
Helper III
Helper III

Welche Produkte beim 2. Kauf

Broeselchen_0-1657604545048.png

Ich möchte gerne nach einer bestimmten ProduktID suchen können, die beim ersten Kauf "Rang Bestellungen" = 1 hat und sehen, welche Produkte dann bei der Bestellung Rang 2 gekauft wurden. Also, Kunden, die beim ersten Kauf Produkt XXX gekauft haben, haben beim 2. Kauf welche Produkte gekauft?

 

1 ACCEPTED SOLUTION

Hi @Broeselchen ,

You can update the formula of calculated column [2. Kauf] as below and check if that is what you want... Please find the details in the attachement.

2. Kauf =
IF (
    'Table'[Belegart] = "RE",
    CONCATENATEX (
        FILTER (
            'Table',
            'Table'[KundenID] = EARLIER ( 'Table'[KundenID] )
                && 'Table'[Rang Bestllungen]
                    = EARLIER ( 'Table'[Rang Bestllungen] ) + 1
                && 'Table'[Belegart] = "RE"
        ),
        'Table'[ProduktID],
        "; ",
        'Table'[ProduktID]
    ),
    BLANK ()
)

yingyinr_0-1658283252682.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

12 REPLIES 12
amitchandak
Super User
Super User

@Broeselchen , A new column

 

Rank = rankx(filter(Table, [KundenID] = earlier( [KundenID] )), [BestellDatum],,asc,dense)

This is what I´ve got already. I need the products of the second order and the possibility to filter for a product from the first order.

 

My question: What buyed the customers in the second order, when they buyed the product x in the first order?

 

Sorry, if my english is not the best 😉

@Broeselchen , if you need product in last order

 

maxx(filter(Table, [KundenID] = earlier( [KundenID] ) &&  [Rank] = earlier( [Rank] ) -1  ), [Product Id])

 

Hope this can help

Yes, I did it in a column, right? But it's not completely what I need, because it could be that there are a few products in the last order. Maybe it's not possible?

Hi @Broeselchen ,

What's your final expected result? Are you trying to get a product that was purchased when Rank was equal to both 1 and 2? If yes, You can create a calculated column as below to get it, please find the details in the attachment. Otherwise, could you please give a practical example of the result you want. Thank you.

Column = 
VAR _1rankproduct =
    CALCULATE (
        MAX ( 'Table'[ProduktID] ),
        FILTER (
            'Table',
            'Table'[KundenID] = EARLIER ( 'Table'[KundenID] )
                && 'Table'[Rang Bestllungen] = 1
        )
    )
VAR _2rankproduct =
    CALCULATE (
        MAX ( 'Table'[ProduktID] ),
        FILTER (
            'Table',
            'Table'[KundenID] = EARLIER ( 'Table'[KundenID] )
                && 'Table'[Rang Bestllungen] = 2
                && 'Table'[ProduktID] = _1rankproduct
        )
    )
RETURN
    IF ( ISBLANK ( _2rankproduct ), BLANK (), _1rankproduct )

yingyinr_0-1657885619211.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thist is what I want to get:

Broeselchen_0-1658133210287.png

But I can't imagine, how it could looks like, because the result needs more than one column or row....

Hi @Broeselchen ,

I updated the sample pbix file(see attachment), please check if that is what you want.

1. Create a measure as below to judge if the product should display

Flag = 
VAR _2rankproducts =
    CALCULATETABLE (
        VALUES ( 'Table'[ProduktID] ),
        FILTER (
            'Table',
            'Table'[KundenID] = SELECTEDVALUE ( 'Table'[KundenID] )
                && 'Table'[Rang Bestllungen] = 2
        )
    )
RETURN
    IF (SELECTEDVALUE( 'Table'[ProduktID]) in _2rankproducts,1,0)

2. Apply the filter on the visual with the condition (Flag is 1)

yingyinr_0-1658134895498.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Nein, leider nicht das, was ich möchte. Ich versuche es mal als Frage zu formulieren. Welche Produkte kaufen Kunden in ihrem 2. Kauf, wenn sie im ersten Kauf Produkt XXX gekauft haben?

Broeselchen_0-1658138568655.png

 

 

Hi @Broeselchen ,

You can create a calculated column as below:

2. Kauf = 
CONCATENATEX (
    FILTER (
        'Table',
        'Table'[KundenID] = EARLIER ( 'Table'[KundenID] )
            && 'Table'[Rang Bestllungen]
                = EARLIER ( 'Table'[Rang Bestllungen] ) + 1
    ),
    'Table'[ProduktID],
    "; "
)

yingyinr_0-1658197940943.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Fast! Ich dachte, ich könnte die Belegart im Visual rausfiltern, aber das geht nicht. Im Datensatz habe ich Bestellungen, Rechnungen und Gutschriften sortiert nach Belegart. Jede Belegart enthält die ProductIDs. Ich möchte aber nur die Produkte der Rechnung. Jetzt erscheint aber jede ProductID mehrfach. Es muss noch ein Filter Belegart RE in die Formel.

Broeselchen_1-1658236948990.png

 

 

Hi @Broeselchen ,

You can update the formula of calculated column [2. Kauf] as below and check if that is what you want... Please find the details in the attachement.

2. Kauf =
IF (
    'Table'[Belegart] = "RE",
    CONCATENATEX (
        FILTER (
            'Table',
            'Table'[KundenID] = EARLIER ( 'Table'[KundenID] )
                && 'Table'[Rang Bestllungen]
                    = EARLIER ( 'Table'[Rang Bestllungen] ) + 1
                && 'Table'[Belegart] = "RE"
        ),
        'Table'[ProduktID],
        "; ",
        'Table'[ProduktID]
    ),
    BLANK ()
)

yingyinr_0-1658283252682.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ja! Vielen, vielen Dank!

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.