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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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 II
Resolver II

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 II
Resolver II

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

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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