Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
grggmrtn
Post Patron
Post Patron

Getting a table that lists people that have ONLY ONE specific value in a category

I have the following data:

Person IDDateServiceProvider
104-01-2021SomethingSomeone
105-01-2021AnotherThingSomeoneElse
206-01-2021SomethingSomeoneElse
307-01-2021SomethingSomeone
308-01-2021AnotherThingSomeoneElse
309-01-2021ThirdThingThirdPerson
410-01-2021AnotherThingSomeone
511-01-2021SomethingSomeoneElse
612-01-2021SomethingThirdPerson
613-01-2021ThirdThingSomeone
714-01-2021SomethingSomeone
815-01-2021ThirdThingSomeone

 

I need a list of the people that have any service provided by "Someone" - but ONLY if they have no other services. So the above example should return Person IDs 4, 7 and 8

 

Any ideas on how I can achieve this?

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @grggmrtn 

The description of the requirement is a bit ambiguous but try the following:

1. Place Table1[ID] in a table visual. Make sure it is set to Don't summarize so that all individual values are shown.

2. Create this measure

Show measure =
VAR check_ =
    CALCULATE ( COUNT ( Table1[Service] ), Table1[Provider] <> "Someone" ) = 0
        && CALCULATE ( COUNT ( Table1[Service] ), Table1[Provider] = "Someone" ) > 0
RETURN
    IF ( check_, 1, 0 )

 3. Place [Show measure] as a filter to the table visual and choose to show when value is 1

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

View solution in original post

7 REPLIES 7
AlB
Super User
Super User

Hi @grggmrtn 

The description of the requirement is a bit ambiguous but try the following:

1. Place Table1[ID] in a table visual. Make sure it is set to Don't summarize so that all individual values are shown.

2. Create this measure

Show measure =
VAR check_ =
    CALCULATE ( COUNT ( Table1[Service] ), Table1[Provider] <> "Someone" ) = 0
        && CALCULATE ( COUNT ( Table1[Service] ), Table1[Provider] = "Someone" ) > 0
RETURN
    IF ( check_, 1, 0 )

 3. Place [Show measure] as a filter to the table visual and choose to show when value is 1

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

There were a few great responses, but this is the one I tried first - worked like a charm - thanks!!

amitchandak
Super User
Super User

@grggmrtn ,

Create a measure like

 


countx(filter(summarize(Table, Table[Person ID], "_1", countdistinct([Provider]), "_2", calculate(countdistinct([Provider]), filter(Table, Table[Provider] ="Someone"))), [_1] =[_2]),[Person ID])

 

and use with person id in visual

AilleryO
Memorable Member
Memorable Member

Another idea, could be using SUMMARIZECOLUMNS to make count grouped by Provider, and finally check that count of Someone is >0 and other counts=0.

Is that of any help ?

amitchandak
Super User
Super User

@grggmrtn , Create a measure like

 


countx(filter(summarize(Table, Table[Person ID], "_1", countdistinct([Provider]), "_2", calculate(countdistinct([Provider]), filter(Table, Table[Provider] ="Someone"))), [_1] =[_2]),[Person ID])

 

and use with person id in visual

AilleryO
Memorable Member
Memorable Member

Not easy to answer without a more detailed context. Can a person ID have multiple lines with Someone ?

If not you can use a COUNT<2 based on Person ID, combined with FILTER function...

Tell us more...

 

@AilleryOYeah that's an oops on my part. A Person ID CAN have multiple lines with Someone - and as long as it's ONLY Someone, I need them to be among the results. The COUNT <2 doesn't work for exactly this reason.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.