Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi all,
Per row, I want to check how many conditions the associated data meets.
E.g. if I have the following table People:
Name | Cash | Eye Color | Shoe Color | Hair Color |
John | 20 | Brown | Brown | Blond |
Jane | 80 | Green | Yellow | Brown |
Doe | 0 | Brown | Yellow | Brown |
I want to do several checks like:
if(cash >50 && eye color == Green), counter +1
if(cash <10 && eye color == Brown), counter +1
if(Shoe Color == Yellow && eye color == Green), counter +1
if(Shoe Color == Brown && eye color == Brown), counter +1
Resulting in:
Name | Cash | Eye Color | Shoe Color | Hair Color | Counter |
John | 20 | Brown | Brown | Blond | 1 |
Jane | 80 | Green | Yellow | Brown | 3 |
Doe | 0 | Brown | Yellow | Brown | 1 |
I know this is possible by creating calculated columns for each check and then adding the results of those calculated columns, but I'd like to contain the complexity within 1 measure/calculated column, rather than spread over the table.
Can anyone tell me if this is possible, and if so, how?
Thanks in advance!
Solved! Go to Solution.
@Anonymous , not very clear
create a new column =if( [cash] > 50 && [eye color] = "Green",1,0) + if( [cash] <10 && [eye color] = "Brown",1,0) + if( [Shoe Color] "Yellow" && [eye color] = "Green",1,0)
+ if( [Shoe Color] "Brown" && [eye color] = "Brown",1,0)
Thanks all! I feel daft now for not think of just adding the if statements together.
Is this what you're looking for?
Hi @Anonymous
You can create a measure with this general formula pattern:
Counter =
var __Check1 = COUNTROWS(
FILTER (Table, Table[Cash] > 50 && Table[Eye Color] = "Green") )
var __Check2 = COUNTROWS( FILTER (Table, **Check2 Conditions**) )
...
var __CheckN = COUNTROWS( FILTER (Table, **CheckN Conditions**) )
RETURN
__var1 + __var2 + ... + __varN + 0 //The +0 at the end keeps the result from being BLANK
Hope this helps
David
@Anonymous , not very clear
create a new column =if( [cash] > 50 && [eye color] = "Green",1,0) + if( [cash] <10 && [eye color] = "Brown",1,0) + if( [Shoe Color] "Yellow" && [eye color] = "Green",1,0)
+ if( [Shoe Color] "Brown" && [eye color] = "Brown",1,0)
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.