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
Anonymous
Not applicable

IF Statement FILTER (At least One field)

Hi, I have this table

 
 
 
ClientContractYES/NO
1aYES
1bNO
1cNO
2dNO
2eNO
3fYES
3gYES
3hNO
4iNO
4jNO

 

How can I COUNT the CLIENTS without YES ? In the example, my count would be = 2 (Client 2 and 4 doenst have any YES)

 

Thanks!

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

See if this works:

 

Measure = 
    CONCATENATEX(
        EXCEPT(
            DISTINCT('Table'[Client]),
            DISTINCT(SELECTCOLUMNS(FILTER('Table',[YES/NO]="YES"),"Client",[Client]))
        ),
        [Client],
        ","
    )

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

PaulDBrown
Community Champion
Community Champion

@Anonymous 

 

To count clients without a "YES":

All Clients = Distinctcount (table [Client])
Clients with "Yes" = CALCULATE(DISTINCTCOUNT(Table [Client]),
                     FILTER( Table,
                     Table [YES/NO] = "YES"))
Clients Without "Yes" = [All Clients] - [Clients with "Yes"]




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

4 REPLIES 4
PaulDBrown
Community Champion
Community Champion

@Anonymous 

 

To count clients without a "YES":

All Clients = Distinctcount (table [Client])
Clients with "Yes" = CALCULATE(DISTINCTCOUNT(Table [Client]),
                     FILTER( Table,
                     Table [YES/NO] = "YES"))
Clients Without "Yes" = [All Clients] - [Clients with "Yes"]




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






gpiero
Skilled Sharer
Skilled Sharer

@Anonymous 

Hi,

according to your data 1a <> 1b, right?

 

Is the following pict the logic you are looking for?

 

pict1.png

If I can...
Greg_Deckler
Super User
Super User

See if this works:

 

Measure = 
    CONCATENATEX(
        EXCEPT(
            DISTINCT('Table'[Client]),
            DISTINCT(SELECTCOLUMNS(FILTER('Table',[YES/NO]="YES"),"Client",[Client]))
        ),
        [Client],
        ","
    )

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi , Thanks for your reply.

 

I wanted to count the Clients but your measure was useful to fix my problem.

 

Regards,

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.