Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Similitude percentage

Hello,

I need some help.

So i have a table like that:

 

I want in power bi to compare two sites and find the % of similitude between them for all the product

So for each site, i want to compare each product (if they are the same or not)

For example if i compare Site A and Site B :

The result should be 100% because for each product (1, 2 and 3) all the criterias (X,Y, Z) perfectly match

Bur for a comparison between Site A and Site C  

The result should be 33,33% because for the product 3 it perfectly match but for the product 1 and 2 there is atleast 1 difference each time for the criterias

So how can i do that?

With also 2 different slicers :

First one to choose the first site

Second one to choose the second site (for a comparison)

Thank you.

 

 

 

 

 

  • HI Anonymous ,

    Pls test to create the below measure:

    TEST = IF(
    CALCULATE (
       COUNTROWS('Table'),
        ALLSELECTED ( 'Table' ),
        'Table'[Product] = MAX ( 'Table'[Product] )
            && 'Table'[CriteriaX] = MAX ( 'Table'[CriteriaX] )
            && 'Table'[CriteriaY] = MAX ( 'Table'[CriteriaY] )
            && 'Table'[CriteriaZ] = MAX ( 'Table'[CriteriaZ] )
    )=2,1,0)
    TEST2 = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[TEST]=1))/COUNTROWS('Table')

    Output result:

    When choose A and  B:

     

    When choose B and C:

     

    When choose A and C:

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


    Best Regards

    Lucien

2 Replies

  • v-luwang-msft's avatar
    v-luwang-msft
    Icon for Community Support rankCommunity Support

    HI Anonymous ,

    Pls test to create the below measure:

    TEST = IF(
    CALCULATE (
       COUNTROWS('Table'),
        ALLSELECTED ( 'Table' ),
        'Table'[Product] = MAX ( 'Table'[Product] )
            && 'Table'[CriteriaX] = MAX ( 'Table'[CriteriaX] )
            && 'Table'[CriteriaY] = MAX ( 'Table'[CriteriaY] )
            && 'Table'[CriteriaZ] = MAX ( 'Table'[CriteriaZ] )
    )=2,1,0)
    TEST2 = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[TEST]=1))/COUNTROWS('Table')

    Output result:

    When choose A and  B:

     

    When choose B and C:

     

    When choose A and C:

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


    Best Regards

    Lucien

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello, it works!

      Thank you.