cancel
Showing results 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.

Frequent Visitor

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

I have the following data in a table:

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:

Best Regards,
Mail2inba4

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

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()
)
``````

``````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])
)``````

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.

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"

)

Announcements

#### 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

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors