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
MostafaGamal
Helper V
Helper V

how to calculate the number or rows that have certain value

Hi All,

I have a SP connected to PBI report and there is coulmn that have certain values (1,2,3,4)

i would like to know how many rows that have value of "1" and "2" 

how to do that ?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @MostafaGamal ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1672026542365.png

2. create a measure with below dax formula

Measure =
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[Rating] IN { 1, 2 } )
RETURN
    COUNTROWS ( tmp )

3. add a card visual with measure

vbinbinyumsft_1-1672026697550.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
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

7 REPLIES 7
Anonymous
Not applicable

Hi @MostafaGamal ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1672026542365.png

2. create a measure with below dax formula

Measure =
VAR tmp =
    FILTER ( ALL ( 'Table' ), 'Table'[Rating] IN { 1, 2 } )
RETURN
    COUNTROWS ( tmp )

3. add a card visual with measure

vbinbinyumsft_1-1672026697550.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Idrissshatila
Super User
Super User

Hello,

 

Try this but put the column name in the measure:

measure = calculate(count(columnName),columnName =1 || columnName = 2)

 

If I answered your question, please mark my post as solution, Appreciate your Kudos!

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




i use the formula but it gives me an error

AbbasG
Memorable Member
Memorable Member

Can you please explain more, i dont have much experince on PBI

@MostafaGamal Please share the sample data or pbix file (after removing all the sensitive information). With the desired output to help you better.

 

there is a snapshot for the table i use its called "answers" 

MostafaGamal_0-1671550034120.png

 

i want to know how many rows of column called "Rating" that have the value of "2" and "1" 

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.