Forum Discussion

George1973's avatar
George1973
Icon for Helper V rankHelper V
4 years ago
Solved

Grouping subsidiary products

Hi All,

Here is a table with two product groups, actualy substituting each other. Non of the products has superiority.

 

Where the colored groups represent the proximity. Here is the table view:

Prod_1Prod_2Group Final
00214087561
00214142671
00273097832
00278118913
00284098294
08756002141
09783002732
09829002844
11891002783
14267002141

 

Please note that, the products in one group do not appear in another groups. The groups are somehow unique.

 

I would like to automaticaly index those groups, like given in the column "Group filter", independent from recordset lengst.

Waitinf ror your proffesional support.

 

Thanks in advance,

  • Hi George1973 
    Please try the following

    Group Final = 
    VAR Prod_1Rank =
        RANKX ( 
            Products,
            Products[Prod_1],,
            ASC,
            Dense
        )
    VAR Prod_2Rank =
        RANKX ( 
            Products,
            Products[Prod_2],,
            ASC,
            Dense
        )
    RETURN
        MIN ( Prod_1Rank, Prod_2Rank )

  • George1973's avatar
    George1973
    4 years ago

    I think I found a problem:

     

    Here are the combinations, which are not grouped vise-versa in the original recordset:

    Meaning that:
    08756 - 00214 - Couple should be also appeared in the recordset as 00214-08756 record and so on..
    Am I right?
    I will ask my ERP administrator to correct the records and I will check your tamerj1 formula again.

    Thanks a lot once again.

     

     

     

6 Replies

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    Hi George1973 
    Please try the following

    Group Final = 
    VAR Prod_1Rank =
        RANKX ( 
            Products,
            Products[Prod_1],,
            ASC,
            Dense
        )
    VAR Prod_2Rank =
        RANKX ( 
            Products,
            Products[Prod_2],,
            ASC,
            Dense
        )
    RETURN
        MIN ( Prod_1Rank, Prod_2Rank )

    • George1973's avatar
      George1973
      Icon for Helper V rankHelper V

      Hi tamerj1 ,
      The solution you've provided seems very interesting and easy. But somehow in some combinations id does not work, unfortunately. For instance:

       

       

      This group should have the same number, but the measure generates two different indexes.. here is the cross check (the second picture)

      As you can see right and left columns are identical in terms of content of analogs, but somehow the group index is different.

       

      Here is another example:

       

       

      In some cases the calculation of the index is right, like here:

       

       

      I do not understand why it happens?!

       

      Here is the original data:

      IDPRODANALOGPRODAnalog_Group

       

       

       

       

       

       

       

       

      • George1973's avatar
        George1973
        Icon for Helper V rankHelper V

        I think I found a problem:

         

        Here are the combinations, which are not grouped vise-versa in the original recordset:

        Meaning that:
        08756 - 00214 - Couple should be also appeared in the recordset as 00214-08756 record and so on..
        Am I right?
        I will ask my ERP administrator to correct the records and I will check your tamerj1 formula again.

        Thanks a lot once again.