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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Count values that match criteria

Hey guys,

I need some help trying to count how many times that multiple condition occur based upon a distinct count. e.g.

 

Invoice | Charge Type

123 | Basic

123 | Intermediate

124 | Basic

124 | intermediate

124 | Complex

 

I would like the count of this to be 1 because there is 1 invoice with all 3 charge types. Im not sure if this makes sense sorry I am only new to this whole thing. Any help is appreciated. Thank you

 

1 ACCEPTED SOLUTION

I am assuming when you say "blanks" you mean the Charge type being blank? Try this measure

 

Invoices with 3 Charges =
COUNTROWS (
    FILTER (
        VALUES ( Table1[Invoice ] ),
        CALCULATE (
            COUNTROWS (
                CALCULATETABLE (
                    VALUES ( Table1[Charge Type] ),
                    Table1[Charge Type] <> BLANK ()
                )
            )
        ) = 3
    )
)

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

This measure will count the number of invoices where the the Charge Type is =3.  The answer is 1.

Measure = COUNTROWS(FILTER(SUMMARIZE(VALUES(Data[Invoice]),[Invoice],"ABCD",DISTINCTCOUNT(Data[Charge Type])),[ABCD]=3))

Hope this helps.


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

@Anonymous 
It would nice if I can see your expected result.

For now you can try this measure. It counts only those invoices which have 3 unique charge types

 

Invoices with 3 Charges = 
COUNTROWS(
    FILTER(
        VALUES(Table1[Invoice ]),
        CALCULATE(COUNTROWS(VALUES(Table1[Charge Type])))=3
    )
)

Hope it helps

Anonymous
Not applicable

That definetly helps thank you.

The only thing that that does is also count blanks. What is the easiest way for it not to count the blank ones

I am assuming when you say "blanks" you mean the Charge type being blank? Try this measure

 

Invoices with 3 Charges =
COUNTROWS (
    FILTER (
        VALUES ( Table1[Invoice ] ),
        CALCULATE (
            COUNTROWS (
                CALCULATETABLE (
                    VALUES ( Table1[Charge Type] ),
                    Table1[Charge Type] <> BLANK ()
                )
            )
        ) = 3
    )
)

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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