Forum Discussion

Pavithra_Ramesh's avatar
Pavithra_Ramesh
Frequent Visitor
1 year ago
Solved

Repeating Values Across Categories

Hi, I have what seems like a very simple question but I am unable to find a way to solve it. Below is my table. I would like to get the  Table Names that repeat or are present in each Lab. That is, the tables that are used across multiple Labs and hence need to be prioritized for migration to a newer platform. 

 

Expected result from the below table:

Tbl1: ABC, XYZ

Tbl3: ABX, XYZ

 

Table structure:

Lab Table Name
ABCTbl1
ABCTbl3
ABCTbl2
XYZTbl1
XYZTbl4
XYZTbl5
XYZTbl3
  • hello Pavithra_Ramesh 

     

    please check if this accomodate your need.

     

    1. create a new calculated column with following DAX.

    Count =
    COUNTX(
        FILTER(
            'Table',
            'Table'[Table Name]=EARLIER('Table'[Table Name])
        ),
        'Table'[Lab ]
    )

     

    2. create a new table with following DAX.

    Table 2 =
    SUMMARIZE(
        FILTER(
            'Table',
            'Table'[Count]>1
        ),
        'Table'[Table Name],
        "Labs",
        CONCATENATEX(
            'Table',
            'Table'[Lab ],
            ", "
        )
    )

     

    Hope this will help.

    Thank you.

  • Hi Pavithra_Ramesh 

    If you need to show all the labs by table you can use the formula 

    TBLS = CONCATENATEX(DISTINCT('Table'[Lab ]),'Table'[Lab ],",")
    if only repeatings
    TBLS_2 =
    VAR
     COUNTROWS_= COUNTROWS(VALUES('Table'[Lab ]))
     RETURN
     IF(COUNTROWS_>1,
     CONCATENATEX(DISTINCT('Table'[Lab ]),'Table'[Lab ],","),BLANK())

    The pbix is attached

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

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Pavithra_Ramesh 

     

    Thanks for the reply from Irwan and Ritaf1983, please allow me to provide my method:

     

    Create two measures as follow:

    TableCount = 
    COUNTROWS(
        CALCULATETABLE(
            'Table',
            ALLEXCEPT('Table', 'Table'[Table Name])
        )
    )

     

    TablesInAllLabs = 
    CALCULATE(
        CONCATENATEX(
            VALUES('Table'[Lab]),
            'Table'[Lab],
            ", "
        ),
        FILTER(
            'Table',
            [TableCount] = COUNTROWS(ALL('Table'[Lab]))
        )
    )

     

    Output:

     

    Best Regards,
    Yulia Xu

     

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

  • Thank you all. This gave me direction. Here is what I used: 

    1. Create a Calculated Table

    DistinctSourceLab =

    SUMMARIZE(

    'Table',

    'Table'[Source],

    'Table'[Lab]

    )

    2. Create a Measure

    Lab_Sources_Concat =

    VAR CurrentSource = SELECTEDVALUE('Table'[Source])

    RETURN

    CONCATENATEX(

    FILTER(

    DistinctSourceLab,

    DistinctSourceLab[Source] = CurrentSource

    ),

    DistinctSourceLab[Lab],

    ", "

    )

5 Replies

  • Hi Pavithra_Ramesh 

    If you need to show all the labs by table you can use the formula 

    TBLS = CONCATENATEX(DISTINCT('Table'[Lab ]),'Table'[Lab ],",")
    if only repeatings
    TBLS_2 =
    VAR
     COUNTROWS_= COUNTROWS(VALUES('Table'[Lab ]))
     RETURN
     IF(COUNTROWS_>1,
     CONCATENATEX(DISTINCT('Table'[Lab ]),'Table'[Lab ],","),BLANK())

    The pbix is attached

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

  • Irwan's avatar
    Irwan
    Super User

    hello Pavithra_Ramesh 

     

    please check if this accomodate your need.

     

    1. create a new calculated column with following DAX.

    Count =
    COUNTX(
        FILTER(
            'Table',
            'Table'[Table Name]=EARLIER('Table'[Table Name])
        ),
        'Table'[Lab ]
    )

     

    2. create a new table with following DAX.

    Table 2 =
    SUMMARIZE(
        FILTER(
            'Table',
            'Table'[Count]>1
        ),
        'Table'[Table Name],
        "Labs",
        CONCATENATEX(
            'Table',
            'Table'[Lab ],
            ", "
        )
    )

     

    Hope this will help.

    Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Pavithra_Ramesh 

     

    Thanks for the reply from Irwan and Ritaf1983, please allow me to provide my method:

     

    Create two measures as follow:

    TableCount = 
    COUNTROWS(
        CALCULATETABLE(
            'Table',
            ALLEXCEPT('Table', 'Table'[Table Name])
        )
    )

     

    TablesInAllLabs = 
    CALCULATE(
        CONCATENATEX(
            VALUES('Table'[Lab]),
            'Table'[Lab],
            ", "
        ),
        FILTER(
            'Table',
            [TableCount] = COUNTROWS(ALL('Table'[Lab]))
        )
    )

     

    Output:

     

    Best Regards,
    Yulia Xu

     

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

  • Thank you all. This gave me direction. Here is what I used: 

    1. Create a Calculated Table

    DistinctSourceLab =

    SUMMARIZE(

    'Table',

    'Table'[Source],

    'Table'[Lab]

    )

    2. Create a Measure

    Lab_Sources_Concat =

    VAR CurrentSource = SELECTEDVALUE('Table'[Source])

    RETURN

    CONCATENATEX(

    FILTER(

    DistinctSourceLab,

    DistinctSourceLab[Source] = CurrentSource

    ),

    DistinctSourceLab[Lab],

    ", "

    )