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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
bacondrops
Frequent Visitor

DAX with multiple filters maybe?

GroupApplicationCompatibility Result
RetirementCash Cow 2.0Yes No
RetirementBlue Hair 3.1No  
InvestmentsCash Cow 2.0Yes No
InvestmentsBlue Hair 3.1No  
InvestmentsDoge Coin 1.9No  
InvestmentsWall Street 5.5No  
Real EstateZillow 9.4Yes Yes
Real EstateSell It All 1.0Yes  
Real EstateCrash 1.1Yes  
InsuranceCash Cow 2.0Yes Yes
InsuranceSell It All 1.0Yes  
InsuranceExistence 2.2Yes  
InsuranceNo Lizards 4.9Yes  

 

So, I have groups that contain different applications within each group.  And each application is marked as compatible (with something else outside this data set).  What I need to do is find out which Group has ALL of it's applications marked with a yes, and which Group has at least 1 no in it and spit those two results out into another column because if there's at least one application within a group that is NOT compatible, then I don't want to mark that Group as compatible.  The Result column above is what I'm looking for.  Hopefully that's clear, I feel like I stumbled through that explanation.  

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @bacondrops ,

Please check if you use the correct table name in the formula. And you can create a calculated column or measure as below to get it, please find the details in the attachment.

Calculated column:

Result = 
VAR _countyes =
    CALCULATE (
        COUNT ( 'Table'[Application] ),
        FILTER (
            'Table',
            'Table'[Group] = EARLIER ( 'Table'[Group] )
                && 'Table'[Compatibility] = "Yes"
        )
    )
VAR _countall =
    CALCULATE (
        COUNT ( 'Table'[Application] ),
        FILTER ( 'Table', 'Table'[Group] = EARLIER ( 'Table'[Group] ) )
    )
RETURN
    IF ( _countyes = _countall, "Yes", "No" )

vyiruanmsft_0-1693470050505.png

Measure:

Measure = 
VAR _group =
    SELECTEDVALUE ( 'Table'[Group] )
VAR _countyes =
    CALCULATE (
        COUNT ( 'Table'[Application] ),
        FILTER ( 'Table', 'Table'[Group] = _group && 'Table'[Compatibility] = "Yes" )
    )
VAR _countall =
    CALCULATE (
        COUNT ( 'Table'[Application] ),
        FILTER ( 'Table', 'Table'[Group] = _group )
    )
RETURN
    IF ( _countyes = _countall, "Yes", "No" )

Best Regards

View solution in original post

5 REPLIES 5
bacondrops
Frequent Visitor

Yes, this will be used in a table visual. 

It's hard to give an exact dax calculation without knowing the exact tables and columns used, and what filters will be active on the report. But I would do something like this. Basically, count the rows in the group, removing all the filters on the same table except compatability, and then filter out Yes & No
Result Measure =

Var YesCnt = calculate(DistinctCount('TableName'[Group]), All('TableName'[Compatability]), 'TableName'[Compatability]="YES")
Var NoCnt= IsBlank(calculate(DistinctCount('TableName'[Group]), All('TableName'[Compatability]), 'TableName'[Compatability]="No")
var noBlankYes=if(isblank(yesCnt),0,yesCnt)

var noBlankNo=if(isblank(noCnt),0,noCnt)
var result = if(and(noBlankYes>0 ,noBlankNo=0),"YES","NO")
return result

 

If this post was helpful, please kudos or accept the answer as a solution.
~ Anthony Genovese
Need more PBI help? PM me for affordable, dedicated training or consultant recomendations!

It's giving me the red squiggly lines on the last 3 variables - Var noBlankYes, Var noBlankNo, and Var result, as well as the Return result line.  It's an Unexpected Expression Var.

Anonymous
Not applicable

Hi @bacondrops ,

Please check if you use the correct table name in the formula. And you can create a calculated column or measure as below to get it, please find the details in the attachment.

Calculated column:

Result = 
VAR _countyes =
    CALCULATE (
        COUNT ( 'Table'[Application] ),
        FILTER (
            'Table',
            'Table'[Group] = EARLIER ( 'Table'[Group] )
                && 'Table'[Compatibility] = "Yes"
        )
    )
VAR _countall =
    CALCULATE (
        COUNT ( 'Table'[Application] ),
        FILTER ( 'Table', 'Table'[Group] = EARLIER ( 'Table'[Group] ) )
    )
RETURN
    IF ( _countyes = _countall, "Yes", "No" )

vyiruanmsft_0-1693470050505.png

Measure:

Measure = 
VAR _group =
    SELECTEDVALUE ( 'Table'[Group] )
VAR _countyes =
    CALCULATE (
        COUNT ( 'Table'[Application] ),
        FILTER ( 'Table', 'Table'[Group] = _group && 'Table'[Compatibility] = "Yes" )
    )
VAR _countall =
    CALCULATE (
        COUNT ( 'Table'[Application] ),
        FILTER ( 'Table', 'Table'[Group] = _group )
    )
RETURN
    IF ( _countyes = _countall, "Yes", "No" )

Best Regards

AnthonyGenovese
Resolver III
Resolver III

I understand how result is caluclated. But how do you want the final result to look like? Will this be a table visual? Only showing Group and Result?

 

If this post was helpful, please kudos or accept the answer as a solution.
~ Anthony Genovese
Need more PBI help? PM me for affordable, dedicated training or consultant recomendations!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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