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

DAX to show the rows when we have the status is only "True"

Hi, I have a table like below where we have 3 columns but for some people in Name has the status both True and False. However, there are people who're status is only True. Now I want to write a DAX to show who are those people who has the status is only True and another Dax to show who are the people who have both the status.

 

Can someone please help me with this?

CountryNameStatus
IndiaAmitTRUE
IndiaAmitFALSE
USAJohnTRUE
USAJohnFALSE
UKChrisTRUE
UKChrisFALSE
IndiaSureshTRUE
IndiaNareshTRUE
UKSmithTRUE
USAAshishTRUE
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

Depending on what you need you can do a measure like the following:

 

 

Only true =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            'Table';
            'Table'[Name];
            "@count"; COUNTA ( 'Table'[Status] )
        );
        [@count] = 1
    )
)

Both States = 
COUNTROWS (
    FILTER (
        SUMMARIZE (
            'Table';
            'Table'[Name];
            "@count"; COUNTA ( 'Table'[Status] )
        );
        [@count] = 2
    )
)

 

 

Check PBIX file attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

6 REPLIES 6
MFelix
Super User
Super User

Hi @Anonymous ,

 

Depending on what you need you can do a measure like the following:

 

 

Only true =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            'Table';
            'Table'[Name];
            "@count"; COUNTA ( 'Table'[Status] )
        );
        [@count] = 1
    )
)

Both States = 
COUNTROWS (
    FILTER (
        SUMMARIZE (
            'Table';
            'Table'[Name];
            "@count"; COUNTA ( 'Table'[Status] )
        );
        [@count] = 2
    )
)

 

 

Check PBIX file attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Thanks @MFelix - It works!

Greg_Deckler
Super User
Super User

@Anonymous  - You should be able to use EXCEPT and INTERSECT. For example, something like this:

 

 

Measure 2 = 
    VAR __Name = MAX('Table (2)'[Name])
    VAR __True = SELECTCOLUMNS(FILTER('Table (2)',[Status]=TRUE()),"Name",[Name])
    VAR __False = SELECTCOLUMNS(FILTER('Table (2)',[Status]=FALSE()),"Name",[Name])
    VAR __Names = SELECTCOLUMNS(EXCEPT(__True,__False),"Name",[Name])
RETURN
    IF(__Name IN __Names,1,BLANK())

 

Note, this is an example of a Complex Selector: https://community.powerbi.com/t5/Quick-Measures-Gallery/The-Complex-Selector/td-p/1116633

 


@ 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 @Greg_Deckler, Thanks for your response. But, I'm getting blank.

@Anonymous - Odd, did you put that measure in a table along with the Name column?


@ 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

Yes! I did.

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.