Forum Discussion
randyvdr
3 years agoFrequent 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
and the following is the how the result should look like:
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:
where:
aditional new column ->> Weighted NPT = DIVIDE([Total Non productive time],[Count of RCA])
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]))))