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

View all the Fabric Data Days sessions on demand. View schedule

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors