Forum Discussion
Filtering the entire group
Hi Team,
How can I filter the entire dataset based on a specific status?
| Name | Status | Date |
| ABC1 | S1 | 1/15/2018 |
| ABC1 | S2 | 2/1/2018 |
| ABC1 | S3 | 2/5/2018 |
| ABC1 | S5 | 4/2/2018 |
| ABC2 | S1 | 2/3/2018 |
| ABC2 | S2 | 3/19/2018 |
| ABC2 | S3 | 4/23/2018 |
| ABC2 | S4 | 4/29/2018 |
| ABC2 | S5 | 5/3/2018 |
| ABC3 | S1 | 4/4/2018 |
In this case, I want to filter out all the individuals who have the status of "S3". So COUNTROWS in the above example will be 1 as ABC1 and ABC2 will get filtered out because they have status of S3. How can I write a measure for this?
3 Replies
- parry2k
Super User
Anonymous add following measure
Count = CALCULATE ( COUNTROWS( Table ), Table[Status] = "S3" ) or Count Records = COUNTROWS ( Table )the first measure will filter for s3, or you can add a slicer for status and use 2nd measure, it will filter based on the selected slicer.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- amitchandak
Super User
Anonymous , Try like
countx(filter(summarize(table, table[name], "_1", calculate(countrows(Table),Table[Status] ="S3" )),[_1]>=1),[name])
removing after aggregation
- DataZoe
Microsoft Employee
Anonymous I think I solved something similar a few weeks ago too, but here is the approach I would try this combination of measures:
Names = distinctcount(Table[Name])
Names Excluding S3 = [Names] - calculate([Names],Table[Status] = "S3")
This will give you a count of distinct names, and then in the second one it takes that total and then removes those that may have that S3 status. If you want to use this in conjunction with a Status slicer (so you pick only those with status S2 and you sitll want to exlude those with an S3 status) then you would need to alter the measure a bit, I think like this, but I'll verify:
Names Excluding S3 = [Names] - calculate([Names],filter(all(Table),Table[Status] = "S3"))