Forum Discussion
Returning count if value contains specific group
- 6 years ago
Hi mcinnisbr
Can you try the following:
Assume that Table1 is the table you created with the columns Facility and Type.
1. Create a new table (Table2) with the following DAX code:
Column1 = Distinct('Table1'[Facility])
2. In this new table, create a second column with the following DAX code:
Column2 = LOOKUPVALUE('Table1'[Type], 'Table1'[Facility], 'Table2'[Column1], "COED")
You should have a table of distinct facilities and a single type.
Hope this helps!
Hi mcinnisbr
Can you try the following:
Assume that Table1 is the table you created with the columns Facility and Type.
1. Create a new table (Table2) with the following DAX code:
Column1 = Distinct('Table1'[Facility])
2. In this new table, create a second column with the following DAX code:
Column2 = LOOKUPVALUE('Table1'[Type], 'Table1'[Facility], 'Table2'[Column1], "COED")
You should have a table of distinct facilities and a single type.
Hope this helps!
Thank you! I'm trying to understand how this works, but it does for sure. Would the related function work with this?
- Greg_Deckler6 years ago
Community Champion
You should be able to use RELATED or RELATEDTABLE with this technique.
Basically, for each row it is filtering the entire table for all rows in the table that have the current value of the column specified by EARLIER (think current row's value for that column). Then you just count the number of rows returned. For the COED ones, there will be 3 but for the others there will only be 1.