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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MSW
Helper I
Helper I

Counting a Specific Value per ID In PowerBI Table

Hello Community, 

 

Can someone help me out seems I cannot find the correct DAX command for making a calculated column. I have made the measure but I really need it in a column format. 

 

The Problem: Want to count the total times a value appears in a column per ID. 

 

Table looks like:

 

IDText ValuesCount of 'True' Value
123

False

1
345True2
567Blank0
123True1
345True2
567True1
789False0

 

 

Thank you!

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @MSW 

 

You can try the following methods.

Count of 'True' Value =
CALCULATE (
    COUNT ( 'Table'[ID] ),
    FILTER ( 'Table', [Text Values] = "TRUE" && [ID] = EARLIER ( 'Table'[ID] ) )
)

vzhangti_0-1649127472130.png

When the ID is 567, the Count of 'True' Value should also be displayed as 1 because there is already a True value.

 

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

4 REPLIES 4
v-zhangti
Community Support
Community Support

Hi, @MSW 

 

You can try the following methods.

Count of 'True' Value =
CALCULATE (
    COUNT ( 'Table'[ID] ),
    FILTER ( 'Table', [Text Values] = "TRUE" && [ID] = EARLIER ( 'Table'[ID] ) )
)

vzhangti_0-1649127472130.png

When the ID is 567, the Count of 'True' Value should also be displayed as 1 because there is already a True value.

 

Best Regards,

Community Support Team _Charlotte

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

MSW
Helper I
Helper I

@Whitewater100 This worked fantastic thank you. I was trying to put the IF statement after countrows. This helped solve my problem and help me learn better options. Thank you! 

Hello- No problem and I understand. Are you able to mark it as a solution? Thanks!

Whitewater100
Solution Sage
Solution Sage

Hi:

When naming your table "Data" we can try this calculated column:

True Times =
var id_value = Data[ID]
return
IF(Data[Text Values] = "TRUE",
COUNTROWS(
FILTER(ALL(
Data),
Data[Text Values] = "TRUE" &&
Data[ID] = id_value)))
 
Whitewater100_0-1648774027596.png

I hope this helped!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.