Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Filtering the entire group

Hi Team,

 

How can I filter the entire dataset based on a specific status?

NameStatusDate
ABC1S11/15/2018
ABC1S22/1/2018
ABC1S32/5/2018
ABC1S54/2/2018
ABC2S12/3/2018
ABC2S23/19/2018
ABC2S34/23/2018
ABC2S44/29/2018
ABC2S55/3/2018
ABC3S14/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

  • 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.

  • Anonymous , Try like

    countx(filter(summarize(table, table[name], "_1", calculate(countrows(Table),Table[Status] ="S3" )),[_1]>=1),[name])

     

    removing after aggregation

  • DataZoe's avatar
    DataZoe
    Icon for Microsoft Employee rankMicrosoft 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"))