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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
randyvdr
Frequent Visitor

Count repeated values and return count

Hello Power Bi Community,

 

Would you please help me creating a measurement that count the number of repeated record ID and returns that number in each of the rows of the same record ID.

 

The following is the table data

randyvdr_0-1679958542377.png

and the following is the how the result should look like:

randyvdr_1-1679958624077.png

the result above result comes from creating new column by the following formula:

Count of RCA = COUNTX(FILTER('incident',EARLIER('incident'[Record job ID])='incident'[Record job ID]),[Record job ID])
 
But i am wondering if i can do it with a measure instead of a column to improve model efficiency.
 
Final goal of the requested measurement is to divide the count of RCA by total Non productive time to assign equitative non productive time for each row. something like this:
 
randyvdr_2-1679958852505.png

where: 

aditional new column ->>   Weighted NPT = DIVIDE([Total Non productive time],[Count of RCA])

 

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@randyvdr 

you can try this to create a measure

Measure = if(HASONEVALUE('Table'[Record job ID]),CALCULATE(count('Table'[Record job ID]),FILTER(all('Table'),'Table'[Record job ID]=max('Table'[Record job ID]))))

1.PNG





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

Proud to be a Super User!




View solution in original post

1 REPLY 1
ryan_mayu
Super User
Super User

@randyvdr 

you can try this to create a measure

Measure = if(HASONEVALUE('Table'[Record job ID]),CALCULATE(count('Table'[Record job ID]),FILTER(all('Table'),'Table'[Record job ID]=max('Table'[Record job ID]))))

1.PNG





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

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.