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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
bstock
Frequent Visitor

Need help with a measure to check multiple rows for a condition...

I have the following data in a table:

 

UserName      isValid

A                      yes

A                      no

A                      yes

B                       yes

B                       yes

B                       yes

 

I would like a measure that would respond  "NOT VALID" for A and "VALID" for B.  Basically, any of the "isValid" = no, then "NOT VALID"....

 

I hope I'm asking this right....

 

4 REPLIES 4
Anonymous
Not applicable

Hi @bstock ,

 

Please use below measure to achive this request.

Measure:
Is_Valid = IF(
COUNTROWS(
FILTER('Sample','Sample'[isValid]="No")
)>0,"Not Valid"
,"Valid")

Output:
Capture.PNG

Best Regards,
Mail2inba4


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-lionel-msft
Community Support
Community Support

Hi @bstock ,

 

Column = 
SWITCH(
    Sheet12[isVaild],
    "yes", "vaild",
    "no", "Not vaild"
)

Column 2 = 
IF(
    Sheet12[Name] = "A" && Sheet12[isVaild] = "no"  || (Sheet12[Name] = "B" && Sheet12[isVaild] = "yes"),
    "XXX",
    BLANK()
)

f7.PNG

Measure1 = 
VAR x=
CALCULATE(
    COUNT(Sheet12[isVaild]),
    FILTER(
        Sheet12,
        Sheet12[Name] = "A" && Sheet12[Column] = "Not vaild"
    )
)
VAR y=
CALCULATE(
    COUNT(Sheet12[isVaild]),
    FILTER(
        Sheet12,
        Sheet12[Name] = "B" && Sheet12[Column] = "vaild"
    )
)
RETURN
IF(
    x >0 || y > 0,
    COUNT(Sheet12[isVaild])
)

f6.PNG

Best regards,
Lionel Chen

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

bstock
Frequent Visitor

 Ok, so I came up with this:

It seems to work as I would have wanted, just curious if there is maybe a better or more flexible way to accomplish this? 

 

isQualified = 
if (
    COUNTROWS(
        FILTER(
            userQuals,
            userQuals[IsQualified] = "FALSE"
        )
    ) > 0,
    "FALSE", "TRUE"
)​

 

 

Anonymous
Not applicable

Instead of COUNTROWS > 0 you could also use ISEMPTY. If your table is large, this might be more efficient as the lines aren't actually counted this way. Like this:

 

IF ( 

    ISEMPTY (

        FILTER(
            userQuals,
            userQuals[IsQualified] = "FALSE"
        )

    ),

    "TRUE",
    "FALSE"

)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.