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
carlosarmpb
Frequent Visitor

Verify Cross-Selling

 

Hello!

 

I'm starting at PowerBI.

 

I have a column with the sales codes and another with the code for my product.

I want to filter through the product code and have all sales codes that have this code listed in the table. But I also want the same table to show the product codes.

 

I do not know if I use stockings or just filter.

 

 

cross-selling.png

2 ACCEPTED SOLUTIONS

@carlosarmpb

 

Hi, One Way is this:

 

Step 1: Add a New Table with Cod Prod

 

Modeling - New Table

 

CodProdTable = DISTINCT(Table1[Cod Prod])

 

 Step 2

 

Add a measure

 

FilterM =
COUNTROWS (
    SUMMARIZE (
        FILTER (
            Table1;
            CALCULATE (
                COUNT ( Table1[Cod Prod] );
                FILTER (
                    ALLEXCEPT ( Table1; Table1[Sales Code] );
                    Table1[Cod Prod] = SELECTEDVALUE ( CodProdTable[Cod Prod] )
                )
            )
                > 0
        );
        Table1[Sales Code]
    )
)

Step 3: And in Visual Level Filter Add this Measure To Is Not Blank

 

FM.png




Lima - Peru

View solution in original post

@carlosarmpb

 

Another Way is Replacing Step 2 with.

 

 

FilterM =
COUNTROWS (
    INTERSECT (
        CALCULATETABLE (
            VALUES ( Table1[Cod Prod] );
            ALLEXCEPT ( Table1; Table1[Sales Code] )
        );
        VALUES ( CodProdTable[Cod Prod] )
    )
)

Regards

 

Victor




Lima - Peru

View solution in original post

4 REPLIES 4
MFelix
Super User
Super User

Hi @carlosarmpb,

 

Based on the image you are showing if you select on the slicer the code 1000 the table will be filter out for the products where prod_code is 1000.

 

What is your expected result and what are your particular requests.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Yeah, that's fine.

 

But I want this table also to show all the product codes that have the same sales code.

@carlosarmpb

 

Another Way is Replacing Step 2 with.

 

 

FilterM =
COUNTROWS (
    INTERSECT (
        CALCULATETABLE (
            VALUES ( Table1[Cod Prod] );
            ALLEXCEPT ( Table1; Table1[Sales Code] )
        );
        VALUES ( CodProdTable[Cod Prod] )
    )
)

Regards

 

Victor




Lima - Peru

@carlosarmpb

 

Hi, One Way is this:

 

Step 1: Add a New Table with Cod Prod

 

Modeling - New Table

 

CodProdTable = DISTINCT(Table1[Cod Prod])

 

 Step 2

 

Add a measure

 

FilterM =
COUNTROWS (
    SUMMARIZE (
        FILTER (
            Table1;
            CALCULATE (
                COUNT ( Table1[Cod Prod] );
                FILTER (
                    ALLEXCEPT ( Table1; Table1[Sales Code] );
                    Table1[Cod Prod] = SELECTEDVALUE ( CodProdTable[Cod Prod] )
                )
            )
                > 0
        );
        Table1[Sales Code]
    )
)

Step 3: And in Visual Level Filter Add this Measure To Is Not Blank

 

FM.png




Lima - Peru

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.