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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
v-binbinyu-msft
Community Support
Community Support

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
v-binbinyu-msft
Community Support
Community Support

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.