Forum Discussion
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 |
| ABC | Tbl1 |
| ABC | Tbl3 |
| ABC | Tbl2 |
| XYZ | Tbl1 |
| XYZ | Tbl4 |
| XYZ | Tbl5 |
| XYZ | Tbl3 |
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.
If you need to show all the labs by table you can use the formula
TBLS = CONCATENATEX(DISTINCT('Table'[Lab ]),'Table'[Lab ],",")if only repeatingsTBLS_2 =VARCOUNTROWS_= COUNTROWS(VALUES('Table'[Lab ]))RETURNIF(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
- Anonymous1 year ago
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 XuIf 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],
", "
)
Hi,
PBI file attached.
Hope this helps.
5 Replies
- Ritaf1983Super User
If you need to show all the labs by table you can use the formula
TBLS = CONCATENATEX(DISTINCT('Table'[Lab ]),'Table'[Lab ],",")if only repeatingsTBLS_2 =VARCOUNTROWS_= COUNTROWS(VALUES('Table'[Lab ]))RETURNIF(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
- IrwanSuper 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.
- AnonymousNot applicable
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 XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Pavithra_RameshFrequent Visitor
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],
", "
)
- Ashish_MathurSuper User