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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Count with DAX when specific value

Greetings,

 

I need help on how to count data when we have an specific value. Sorry in advance if this has been answered somewhere else, I tried several cases found here but none of them worked for this case.

 

Our goal: Obtain the Nº of TestCode that have zero Pass_Fail_Error “F” value, 1 or more than 1.

 

Given a table like this one here.

AlexLC_1-1681899771612.png

Testcode nº of F per Testcode

AlexLC_2-1681899780362.png

 

We should get an array like this.

Measure: [nº of TestCode = 0, nº of TestCode = 1, nº of TestCode > 1]

Example:

Measure [1, 1, 2]

______________________________

Or 3 diferent measures

Measure 1: Nº of TestCode that have zero Pass_Fail_Error “F” value                     1

Measure 2: Nº of TestCode that have one Pass_Fail_Error “F” value                       1

Measure 3: Nº of TestCode that have more than 1 Pass_Fail_Error “F” value       2

 

Does anyone know how to solve this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous ,

You can create a variable with summarize function to aggregate records that has Code 'F' and group based on ‘Test Code’ and ‘FPcode’ categoried, and add custom fields to get correspond record count.

formula =
VAR summary =
    SUMMARIZE (
        FILTER ( ALLSELECTED ( Table ), [Fail_Pass_Code] = "F" ),
        [TestCode],
        [Fail_Pass_Code],
        "_Count", COUNTA ( Table[Fail_Pass_Code] )
    )
RETURN
    SUMX ( summary, [_Count] )

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI @Anonymous ,

You can create a variable with summarize function to aggregate records that has Code 'F' and group based on ‘Test Code’ and ‘FPcode’ categoried, and add custom fields to get correspond record count.

formula =
VAR summary =
    SUMMARIZE (
        FILTER ( ALLSELECTED ( Table ), [Fail_Pass_Code] = "F" ),
        [TestCode],
        [Fail_Pass_Code],
        "_Count", COUNTA ( Table[Fail_Pass_Code] )
    )
RETURN
    SUMX ( summary, [_Count] )

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.