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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
GJUDGE
Helper II
Helper II

Count with Multiple Criteria

I'm sorry if similar questions have been asked before but I am trying to count rows based on different criteria:

 

ProjectStatus 1Status 2Status 3
A1400200
B2-200-100
C3200-100

 

I am trying to work out a formula which will show the following:

 

Count If Status 1 = 1 and Status 2 and Status 3 are both positive values, return "all status ok"

Count If Status 1 = 2 or 3 and either status 2 or 3 have one value positive and one value negative, return "some status ok"

Count If status 1 = 3 and both status 2 and 3 are negative, return "no status ok".

 

Thanks in advance.

 

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @GJUDGE

 

Is this your expected output?

vxulinmstf_0-1631774561914.png

Create measures as:

all status ok = 
CALCULATE(
    COUNTROWS('Table 1'),
    FILTER(
        'Table 1',
        'Table 1'[Status 1]=1 && 'Table 1'[Status 2]>0 && 'Table 1'[Status 3]>0
    ))
some status ok = 
CALCULATE(
    COUNTROWS('Table 1'),
    FILTER(
        'Table 1',
        'Table 1'[Status 1] in {2,3} && 'Table 1'[Status 2] * 'Table 1'[Status 3] <0
    ))
no status ok = 
CALCULATE(
    COUNTROWS('Table 1'),
    FILTER(
        'Table 1',
        'Table 1'[Status 1]=3 && 'Table 1'[Status 2]<0 && 'Table 1'[Status 3]<0
    ))

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

View solution in original post

2 REPLIES 2
v-xulin-mstf
Community Support
Community Support

Hi @GJUDGE

 

Is this your expected output?

vxulinmstf_0-1631774561914.png

Create measures as:

all status ok = 
CALCULATE(
    COUNTROWS('Table 1'),
    FILTER(
        'Table 1',
        'Table 1'[Status 1]=1 && 'Table 1'[Status 2]>0 && 'Table 1'[Status 3]>0
    ))
some status ok = 
CALCULATE(
    COUNTROWS('Table 1'),
    FILTER(
        'Table 1',
        'Table 1'[Status 1] in {2,3} && 'Table 1'[Status 2] * 'Table 1'[Status 3] <0
    ))
no status ok = 
CALCULATE(
    COUNTROWS('Table 1'),
    FILTER(
        'Table 1',
        'Table 1'[Status 1]=3 && 'Table 1'[Status 2]<0 && 'Table 1'[Status 3]<0
    ))

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

Ashish_Mathur
Super User
Super User

Hi,

Try this calculated column formula

=if(Data[Status1]=3&&Data[Status2]<0&&Data[Status]3<0,"No status OK",if(Data[Status1]=1,if(and(Data[Status2]>0,Data[Status3]>0),"All Status OK","Blank()),sign(Data[Status2]*Data[Status3])=-1,"some status OK"))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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