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
franctambu
New Member

Rank couple of sold products.

Hi everyone, 

the question is a bit tricky. I want to know the best couple of products sold to the costumers. I think it could be clearer if I post an image: 

franctambu_0-1593769545695.png

 

Do you have some suggestion to solve it with dax?

Thanks

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @franctambu ,

 

We can use two ways to meet your requirement.

The first way is to create a merge table.

 

1. In Power Query Editor, we can merge the same table to get a new table.

 

rank1.jpg

 

2. Then we can add a customer to combine the product column.

 

rank2.jpg

 

3. At last we can filter the customer as XY, XZ, YZ.

 

rank3.jpg

 

The second way is to create a new table and a measure.

 

1. Create a new table using Enter data and create two columns in it.

 

Column1 = LEFT('check table'[Rank],1)
Column2 = RIGHT('check table'[Rank],1)

 

rank4.jpg

 

2. Then we need to create a new custom column using Power Query Editor to combine each product.

 

rank5.jpg

 

3. At last we can create a measure to get the result.

 

VALUE = 
COUNTROWS (
        FILTER (
            'Product',
            SEARCH ( MAX ( 'check table'[Column1] ), 'Product'[Pro], 1, 0 ) > 0 && SEARCH ( MAX ( 'check table'[Column2] ), 'Product'[Pro], 1, 0 ) > 0
        ))

 

rank6.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

2 REPLIES 2
v-zhenbw-msft
Community Support
Community Support

Hi @franctambu ,

 

We can use two ways to meet your requirement.

The first way is to create a merge table.

 

1. In Power Query Editor, we can merge the same table to get a new table.

 

rank1.jpg

 

2. Then we can add a customer to combine the product column.

 

rank2.jpg

 

3. At last we can filter the customer as XY, XZ, YZ.

 

rank3.jpg

 

The second way is to create a new table and a measure.

 

1. Create a new table using Enter data and create two columns in it.

 

Column1 = LEFT('check table'[Rank],1)
Column2 = RIGHT('check table'[Rank],1)

 

rank4.jpg

 

2. Then we need to create a new custom column using Power Query Editor to combine each product.

 

rank5.jpg

 

3. At last we can create a measure to get the result.

 

VALUE = 
COUNTROWS (
        FILTER (
            'Product',
            SEARCH ( MAX ( 'check table'[Column1] ), 'Product'[Pro], 1, 0 ) > 0 && SEARCH ( MAX ( 'check table'[Column2] ), 'Product'[Pro], 1, 0 ) > 0
        ))

 

rank6.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

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.