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
Rihab
Frequent Visitor

Calculate the number of rows that has an exact value for distinct ids

IMG_2308.jpeg

Hello, 

i am new in power bi world and I would like to create a measure that counts how many Rows had the value to investigate but for distinct Id , means if we have 3 rows with ´to investigate "value it should be counted as 1. Here is an example of data , the measure should show 3 as a result 

thank you in advance

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@Rihab , you can try using below measure

DistinctCountToInvestigate =
CALCULATE(
DISTINCTCOUNT(YourTable[Id]),
YourTable[Value] = "to investigate"
)

 

Replace value as 3 and mention your table name it will work





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

7 REPLIES 7
bhanu_gautam
Super User
Super User

@Rihab , you can try using below measure

DistinctCountToInvestigate =
CALCULATE(
DISTINCTCOUNT(YourTable[Id]),
YourTable[Value] = "to investigate"
)

 

Replace value as 3 and mention your table name it will work





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




manvishah17
Resolver I
Resolver I

Hi @Rihab , 
In my sample data 'to Investigate' is 4 time so...
for only 'To investigate' , you can use this 
Screenshot 2024-05-06 174823.png

 the 3 rows of value "to investigate" for ID 1 should be counted as 1 , is there possible to do it without using filters , it should be in the measure , also in your first response you are counting on ID, by my goal to count the value "to investigate" 

 

Okay @Rihab ,
I got your point, you can count on values, but for choosing only one "to investigate", you need to choose it from filter whether it can  be a slicer , or visual level filter.

Count = 
 CALCULATE(
    DISTINCTCOUNT(Sheet2[value])
 )

Screenshot 2024-05-06 184512.png

jay_patel
Helper IV
Helper IV

Just add visual level filter for value = "To investigate". it will gives you distinct count for that only.

manvishah17
Resolver I
Resolver I

Hi @Rihab ,
In order to count distinct id you can use this measure ,

 

Count = 
DISTINCTCOUNT(Sheet2[id])

 

See I have created sample file and it shows following results ,
Screenshot 2024-05-06 170556.png

 

Screenshot 2024-05-06 170152.png

 

 If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

thank you for your quick response but I need only to calculate only when the value is "to investigate" and the KPI should show 3 not 4 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.