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.
Hi, please help in this query wherein i want to count the number of times a value appears row-wise in a separate column "DuplicateCount":-
Should i use measure insted of adding a column?
a shows 2 because it appears 2 times, b shows 3, c shows 4
Value | DuplicateCount |
a | 2 |
b | 3 |
c | 4 |
a | 2 |
b | 3 |
c | 4 |
c | 4 |
b | 3 |
c | 4 |
Solved! Go to Solution.
@Anonymous ,
As measure
DuplicateCount= calculate(count(Table[Value]),allexcept(Table[Value]))
or
DuplicateCount= calculate(count(Table[Value]),filter(allselected(Table),Table[Value] =max(Table[Value])))
As a new column
DuplicateCount= countX(filter(allselected(Table),Table[Value] =earlier(Table[Value])),Table[Value])
Actually no visual will repeat value column unless you have an index column or some other column. so Count(Table[Value]) will also do.
@Anonymous ,
As measure
DuplicateCount= calculate(count(Table[Value]),allexcept(Table[Value]))
or
DuplicateCount= calculate(count(Table[Value]),filter(allselected(Table),Table[Value] =max(Table[Value])))
As a new column
DuplicateCount= countX(filter(allselected(Table),Table[Value] =earlier(Table[Value])),Table[Value])
Actually no visual will repeat value column unless you have an index column or some other column. so Count(Table[Value]) will also do.
Hi @Anonymous ,
Just create a measure as follows:
cntElement = COUNTROWS(yourtablename)
Move this measure to a table visual along with your VALUE column.
Thanks,
Pragati
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
97 | |
96 | |
81 | |
74 | |
66 |
User | Count |
---|---|
129 | |
106 | |
106 | |
86 | |
72 |