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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Marcegon
Helper II
Helper II

How can I count rows containing # 1 only

Hi, I have a query with (3) columns "Name, attribute, and value".  I need the total for only those rows containing # 1. 

How could I achieve this?

 

Thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Marcegon , Hello @sevenhills , thank you for your prompt reply!
Try the measure as shown below:

CountRowsWithOnlyOnes =
CALCULATE(
   COUNTROWS('YourTable'),
   FILTER(
       'YourTable',
       AND(
           'YourTable'[Column1] = 1,
           'YourTable'[Column2] = 1,
           'YourTable'[Column3] = 1,
           //you can add other conditions
       )
   )
)

Please feel free to respond if there is any misunderstanding about your question.

Best regards,

Joyce

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

5 REPLIES 5
Anonymous
Not applicable

Hi @Marcegon , Hello @sevenhills , thank you for your prompt reply!
Try the measure as shown below:

CountRowsWithOnlyOnes =
CALCULATE(
   COUNTROWS('YourTable'),
   FILTER(
       'YourTable',
       AND(
           'YourTable'[Column1] = 1,
           'YourTable'[Column2] = 1,
           'YourTable'[Column3] = 1,
           //you can add other conditions
       )
   )
)

Please feel free to respond if there is any misunderstanding about your question.

Best regards,

Joyce

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

Marcegon
Helper II
Helper II

Thank you!  I forgot to mention that I need to show the rows with other values as "0".  The visual should should attributes with a value of "0" when there is no attribute with a value of 1."  How can I achieve this?

 

CountRowsWithValue1 = 
COALESCE(COUNTROWS(FILTER('Table 1', 'Table 1'[Value] = 1)), 0)

CountRowsWithValue1 = 
COALESCE(COUNTROWS(FILTER('Table 1', 'Table 1'[Value] = "# 1")), 0)

 


Using COALESCE, you can achieve it. See if the above syntax for your needs!

sevenhills
Super User
Super User

Try this? It was not clear whether you want to filter 1 or "# 1", provided both...

 

 

CountRowsWithValue1 = 
COUNTROWS(FILTER('Table 1', 'Table 1'[Value] = 1))

CountRowsWithValue1 = 
COUNTROWS(FILTER('Table 1', 'Table 1'[Value] = "# 1"))

 

Thank you. The visual needs to show the number of issues per field; therefore it needs to count # 1s.  However, when there is other number, I want it to show "0" (see visual below)

Marcegon_0-1721678608189.png

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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